From 8d706b4ef942e01814f0a9db519aa32505b9abed Mon Sep 17 00:00:00 2001 From: aunsane Date: Fri, 29 Sep 2017 00:22:53 +0300 Subject: MirLua: added service functions to execute lua code version bump --- plugins/ExternalAPI/m_lua.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'plugins/ExternalAPI') diff --git a/plugins/ExternalAPI/m_lua.h b/plugins/ExternalAPI/m_lua.h index 5d3fcda7bc..0a87455607 100644 --- a/plugins/ExternalAPI/m_lua.h +++ b/plugins/ExternalAPI/m_lua.h @@ -1,4 +1,34 @@ #ifndef _M_LUA_H_ #define _M_LUA_H_ +// Call lua function from module +// wParam = module name (or NULL for global function) +// lParam = function name +// Returns a pointer to the resolved string +#define MS_LUA_CALL "Lua/Call" + +__inline static wchar_t *lua_call(const wchar_t *module, const wchar_t *function) { + return (wchar_t*)CallService(MS_LUA_CALL, (WPARAM)module, (LPARAM)function); +} + +// Execute lua script from file +// wParam = NULL +// lParam = file path +// Returns a pointer to the resolved string +#define MS_LUA_EXEC "Lua/Exec" + +__inline static wchar_t *lua_exec(const wchar_t *path) { + return (wchar_t*)CallService(MS_LUA_EXEC, NULL, (LPARAM)path); +} + +// Evaluate lua script from string +// wParam = NULL +// lParam = lua script +// Returns a pointer to the resolved string +#define MS_LUA_EVAL "Lua/Eval" + +__inline static wchar_t *lua_eval(const wchar_t *script) { + return (wchar_t*)CallService(MS_LUA_EVAL, NULL, (LPARAM)script); +} + #endif //_M_LUA_H_ -- cgit v1.2.3