1 #ifndef LUATB_TYPED_STACK_H 2 #define LUATB_TYPED_STACK_H 30 static typename std::enable_if<!IsCallable<T>::value,
T>::type
getArgument(lua_State *lua)
32 T value = LuaTBTypedStack::getFromLuaStack<T>(lua);
48 static typename std::enable_if<IsCallable<T>::value,
T>::type
getArgument(lua_State *lua)
54 int *ref =
new int(luaL_ref(lua, LUA_REGISTRYINDEX));
84 template<
typename Ret,
typename...
Args>
93 static std::function<
void (
Args...)> value(lua_State *lua,
int *ref)
108 template<
typename Ret,
typename...
Args>
112 lua_rawgeti(lua, LUA_REGISTRYINDEX, *ref);
116 lua_pushvalue(lua, 1);
120 lua_pcall(lua,
sizeof...(args), 0, 0);
123 lua_unref(lua, *ref);
124 *ref = luaL_ref(lua, LUA_REGISTRYINDEX);
145 template<
typename First,
typename...
Args>
165 #endif // LUATB_TYPED_STACK_H static T getFromLuaStack(lua_State *lua)
Get a value from the lua stack and convert it to type 'T'.
static std::list< std::unique_ptr< int > > callbackRefs
Definition: luatb_typed_stack.h:163
internal::ArgsMatcher< InnerMatcher > Args(const InnerMatcher &matcher)
Definition: gmock-generated-matchers.h:671
typedef void(ENET_CALLBACK *ENetPacketFreeCallback)(struct _ENetPacket *)
Represents a typed version of the lua stack.
Definition: luatb_typed_stack.h:18
static std::enable_if< IsCallable< T >::value, T >::type getArgument(lua_State *lua)
Get a function-type argument from the lua stack and convert it to type 'T'.
Definition: luatb_typed_stack.h:48
Definition: luatb_typed_stack.h:62
static std::enable_if<!IsCallable< T >::value, T >::type getArgument(lua_State *lua)
Get a non-function argument from the lua stack and convert it to type 'T'.
Definition: luatb_typed_stack.h:30
Definition: InputPrereqs.h:78
Defines several very important macros used to register objects, register classes, and to work with id...
static void pushArgumentsToLuaStack(lua_State *, T)
Pushes nothing onto the stack.
Definition: luatb_typed_stack.h:137
static void callLuaFunction(lua_State *lua, int *ref, Args...args)
Pushes all arguments to the lua stack and calls a lua function afterwards.
Definition: luatb_typed_stack.h:110
static void pushToLuaStack(lua_State *lua, T value)
Pushes a value to the lua stack.