summaryrefslogtreecommitdiff
path: root/plugins/ExternalAPI/m_lua.h
blob: 0a874556073a0f9b62795176109cb7f34cfeafe2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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_