simpler Lua boilerplate

This commit is contained in:
Glenn Maynard
2006-09-27 19:53:05 +00:00
parent 4002071bea
commit ea7c05cee5
8 changed files with 30 additions and 45 deletions
+3 -5
View File
@@ -380,17 +380,15 @@ void Screenshot::LoadFromNode( const XNode* pNode )
class LunaHighScore: public Luna<HighScore>
{
public:
LunaHighScore() { LUA->Register( Register ); }
static int GetName( T* p, lua_State *L ) { lua_pushstring(L, p->GetName() ); return 1; }
static int GetScore( T* p, lua_State *L ) { lua_pushnumber(L, p->GetScore() ); return 1; }
static void Register(lua_State *L)
LunaHighScore()
{
LUA->Register( Register );
ADD_METHOD( GetName );
ADD_METHOD( GetScore );
Luna<T>::Register( L );
}
};