register g_LuaFunctions in LuaManager::RegisterTypes

make RegisterTypes private
cleanup
This commit is contained in:
Glenn Maynard
2005-05-29 21:12:30 +00:00
parent c724b4ad53
commit 2069d9cbeb
2 changed files with 8 additions and 14 deletions
+4 -11
View File
@@ -10,14 +10,7 @@
#include <csetjmp> #include <csetjmp>
#include <cassert> #include <cassert>
/*
#include "Actor.h"
void foo()
{
Actor *p = NULL;
LuaHelpers::Push( p, NULL );
}
*/
LuaManager *LUA = NULL; LuaManager *LUA = NULL;
static LuaFunctionList *g_LuaFunctions = NULL; static LuaFunctionList *g_LuaFunctions = NULL;
@@ -171,6 +164,9 @@ LuaManager::~LuaManager()
void LuaManager::RegisterTypes() void LuaManager::RegisterTypes()
{ {
for( const LuaFunctionList *p = g_LuaFunctions; p; p=p->next )
lua_register( L, p->name, p->func );
if( g_vRegisterActorTypes ) if( g_vRegisterActorTypes )
{ {
for( unsigned i=0; i<g_vRegisterActorTypes->size(); i++ ) for( unsigned i=0; i<g_vRegisterActorTypes->size(); i++ )
@@ -201,9 +197,6 @@ void LuaManager::ResetState()
luaopen_table( L ); luaopen_table( 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
for( const LuaFunctionList *p = g_LuaFunctions; p; p=p->next )
lua_register( L, p->name, p->func );
RegisterTypes(); RegisterTypes();
LuaReference::AfterResetAll(); LuaReference::AfterResetAll();
+4 -3
View File
@@ -53,9 +53,6 @@ public:
bool RunScriptFile( const CString &sFile ); bool RunScriptFile( const CString &sFile );
/* Register all subscribing types. There's no harm in registering when already registered. */
void RegisterTypes();
/* Reset the environment, freeing any globals left over by previously executed scripts. */ /* Reset the environment, freeing any globals left over by previously executed scripts. */
void ResetState(); void ResetState();
@@ -97,6 +94,10 @@ public:
static void ReadArrayFromTableB( vector<bool> &aOut, lua_State *L = NULL ); static void ReadArrayFromTableB( vector<bool> &aOut, lua_State *L = NULL );
lua_State *L; lua_State *L;
private:
/* Register all subscribing types. There's no harm in registering when already registered. */
void RegisterTypes();
}; };