summaryrefslogtreecommitdiff
path: root/plugins/MirLua/include/mirlua.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MirLua/include/mirlua.h')
-rw-r--r--plugins/MirLua/include/mirlua.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/MirLua/include/mirlua.h b/plugins/MirLua/include/mirlua.h
new file mode 100644
index 0000000000..eee10289bb
--- /dev/null
+++ b/plugins/MirLua/include/mirlua.h
@@ -0,0 +1,23 @@
+#ifndef _MIRLUA_H_
+#define _MIRLUA_H_
+
+#include <lua.hpp>
+
+__forceinline UINT_PTR luaM_tomparam(lua_State *L, int idx)
+{
+ switch (lua_type(L, idx))
+ {
+ case LUA_TBOOLEAN:
+ return lua_toboolean(L, idx);
+ case LUA_TSTRING:
+ return (UINT_PTR)lua_tostring(L, idx);
+ case LUA_TLIGHTUSERDATA:
+ return (UINT_PTR)lua_touserdata(L, idx);
+ case LUA_TNUMBER:
+ if (lua_isinteger(L, idx))
+ return (UINT_PTR)lua_tointeger(L, idx);
+ }
+ return NULL;
+}
+
+#endif //_MIRLUA_H_ \ No newline at end of file