diff options
Diffstat (limited to 'plugins/MirLua/Modules/m_variables/src')
| -rw-r--r-- | plugins/MirLua/Modules/m_variables/src/main.cpp | 32 | ||||
| -rw-r--r-- | plugins/MirLua/Modules/m_variables/src/stdafx.cxx | 1 | ||||
| -rw-r--r-- | plugins/MirLua/Modules/m_variables/src/stdafx.h | 14 | 
3 files changed, 47 insertions, 0 deletions
diff --git a/plugins/MirLua/Modules/m_variables/src/main.cpp b/plugins/MirLua/Modules/m_variables/src/main.cpp new file mode 100644 index 0000000000..1fb6dd29bb --- /dev/null +++ b/plugins/MirLua/Modules/m_variables/src/main.cpp @@ -0,0 +1,32 @@ +#include "stdafx.h"
 +
 +static int lua_Parse(lua_State *L)
 +{
 +	if (!ServiceExists(MS_VARS_FORMATSTRING))
 +	{
 +		lua_pushvalue(L, 1);
 +		return 1;
 +	}
 +
 +	ptrT format(mir_utf8decodeT(luaL_checkstring(L, 1)));
 +	MCONTACT hContact = lua_tointeger(L, 2);
 +
 +	TCHAR *res = variables_parse_ex(format, NULL, hContact, NULL, 0);
 +	lua_pushstring(L, T2Utf(res));
 +
 +	return 1;
 +}
 +
 +static luaL_Reg variablesApi[] =
 +{
 +	{ "Parse", lua_Parse },
 +
 +	{ NULL, NULL }
 +};
 +
 +LUAMOD_API int luaopen_m_variables(lua_State *L)
 +{
 +	luaL_newlib(L, variablesApi);
 +
 +	return 1;
 +}
 diff --git a/plugins/MirLua/Modules/m_variables/src/stdafx.cxx b/plugins/MirLua/Modules/m_variables/src/stdafx.cxx new file mode 100644 index 0000000000..fd4f341c7b --- /dev/null +++ b/plugins/MirLua/Modules/m_variables/src/stdafx.cxx @@ -0,0 +1 @@ +#include "stdafx.h" diff --git a/plugins/MirLua/Modules/m_variables/src/stdafx.h b/plugins/MirLua/Modules/m_variables/src/stdafx.h new file mode 100644 index 0000000000..0293856dbd --- /dev/null +++ b/plugins/MirLua/Modules/m_variables/src/stdafx.h @@ -0,0 +1,14 @@ +#ifndef _COMMON_H_
 +#define _COMMON_H_
 +
 +#include <windows.h>
 +
 +#define VARIABLES_NOHELPER
 +
 +#include <lua.hpp>
 +
 +#include <m_core.h>
 +#include <m_utils.h>
 +#include <m_variables.h>
 +
 +#endif //_COMMON_H_
\ No newline at end of file  | 
