remove LuaManager::PushNopFunction(). Just compile an empty function;
it'll be tiny, anyway.
This commit is contained in:
@@ -14,13 +14,6 @@ ActorCommands::ActorCommands( const Commands& cmds )
|
|||||||
|
|
||||||
void ActorCommands::Register()
|
void ActorCommands::Register()
|
||||||
{
|
{
|
||||||
if( m_cmds.v.size() == 0 )
|
|
||||||
{
|
|
||||||
LUA->PushNopFunction();
|
|
||||||
this->SetFromStack();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Convert cmds to a Lua function
|
// Convert cmds to a Lua function
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -59,13 +59,6 @@ void LuaManager::PushStackNil()
|
|||||||
lua_pushnil( L );
|
lua_pushnil( L );
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaManager::PushNopFunction()
|
|
||||||
{
|
|
||||||
lua_rawgeti( LUA->L, LUA_REGISTRYINDEX, m_iNopFunction );
|
|
||||||
|
|
||||||
ASSERT_M( !lua_isnil(L, -1), ssprintf("%i", m_iNopFunction) )
|
|
||||||
}
|
|
||||||
|
|
||||||
void LuaManager::PushStack( int out, lua_State *L )
|
void LuaManager::PushStack( int out, lua_State *L )
|
||||||
{
|
{
|
||||||
if( L == NULL )
|
if( L == NULL )
|
||||||
@@ -221,10 +214,6 @@ void LuaManager::ResetState()
|
|||||||
luaopen_string( L );
|
luaopen_string( L );
|
||||||
lua_settop(L, 0); // luaopen_* pushes stuff onto the stack that we don't need
|
lua_settop(L, 0); // luaopen_* pushes stuff onto the stack that we don't need
|
||||||
|
|
||||||
/* Set up the NOP function pointer. */
|
|
||||||
RunScript( "return function() end", 1 );
|
|
||||||
m_iNopFunction = luaL_ref( L, LUA_REGISTRYINDEX );
|
|
||||||
|
|
||||||
for( const LuaFunctionList *p = g_LuaFunctions; p; p=p->next )
|
for( const LuaFunctionList *p = g_LuaFunctions; p; p=p->next )
|
||||||
lua_register( L, p->name, p->func );
|
lua_register( L, p->name, p->func );
|
||||||
|
|
||||||
|
|||||||
@@ -58,8 +58,6 @@ public:
|
|||||||
/* Run an expression. The result is left on the Lua stack. */
|
/* Run an expression. The result is left on the Lua stack. */
|
||||||
bool RunExpression( const CString &str );
|
bool RunExpression( const CString &str );
|
||||||
lua_State *L;
|
lua_State *L;
|
||||||
private:
|
|
||||||
int m_iNopFunction;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern LuaManager *LUA;
|
extern LuaManager *LUA;
|
||||||
|
|||||||
Reference in New Issue
Block a user