summaryrefslogtreecommitdiff
path: root/plugins/ExternalAPI
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2017-09-29 00:22:53 +0300
committeraunsane <aunsane@gmail.com>2017-09-29 00:39:19 +0300
commit8d706b4ef942e01814f0a9db519aa32505b9abed (patch)
treeec3cd0464d4862f42041936958595c057abdfb78 /plugins/ExternalAPI
parentaf9c3d7de7e35632d046575b5e4809a04abec816 (diff)
MirLua: added service functions to execute lua code
version bump
Diffstat (limited to 'plugins/ExternalAPI')
-rw-r--r--plugins/ExternalAPI/m_lua.h30
1 files changed, 30 insertions, 0 deletions
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_