summaryrefslogtreecommitdiff
path: root/plugins/MirLua/include/mirlua.h
blob: eee10289bb80a3c980ca180aa043ca563d5dd997 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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_