simpler Lua boilerplate

This commit is contained in:
Glenn Maynard
2006-09-27 20:03:31 +00:00
parent ea7c05cee5
commit 153bcedd40
19 changed files with 64 additions and 96 deletions
+3 -5
View File
@@ -224,21 +224,19 @@ bool Workout::SaveToFile( RString sFile )
class LunaWorkout: public Luna<Workout>
{
public:
LunaWorkout() { LUA->Register( Register ); }
static int GetName( T* p, lua_State *L ) { lua_pushstring(L, p->m_sName ); return 1; }
static int GetMinutes( T* p, lua_State *L ) { lua_pushnumber(L, p->m_iMinutes ); return 1; }
static int GetEstimatedNumSongs( T* p, lua_State *L ) { lua_pushnumber(L, p->GetEstimatedNumSongs() ); return 1; }
static int GetWorkoutStepsType( T* p, lua_State *L ) { lua_pushnumber(L, p->m_WorkoutStepsType ); return 1; }
static void Register(lua_State *L)
LunaWorkout()
{
LUA->Register( Register );
ADD_METHOD( GetName );
ADD_METHOD( GetMinutes );
ADD_METHOD( GetEstimatedNumSongs );
ADD_METHOD( GetWorkoutStepsType );
Luna<T>::Register( L );
}
};