simpler Lua boilerplate
This commit is contained in:
@@ -198,24 +198,19 @@ void Character::UndemandGraphics()
|
||||
class LunaCharacter: public Luna<Character>
|
||||
{
|
||||
public:
|
||||
LunaCharacter() { LUA->Register( Register ); }
|
||||
|
||||
static int GetCardPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetCardPath() ); return 1; }
|
||||
static int GetIconPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetIconPath() ); return 1; }
|
||||
static int GetSongSelectIconPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetSongSelectIconPath() ); return 1; }
|
||||
static int GetStageIconPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetStageIconPath() ); return 1; }
|
||||
|
||||
RString GetCardPath() const;
|
||||
RString GetIconPath() const;
|
||||
|
||||
static void Register( Lua *L )
|
||||
LunaCharacter()
|
||||
{
|
||||
LUA->Register( Register );
|
||||
|
||||
ADD_METHOD( GetCardPath );
|
||||
ADD_METHOD( GetIconPath );
|
||||
ADD_METHOD( GetSongSelectIconPath );
|
||||
ADD_METHOD( GetStageIconPath );
|
||||
|
||||
Luna<T>::Register( L );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -281,7 +281,6 @@ void Screen::ClearMessageQueue( const ScreenMessage SM )
|
||||
class LunaScreen: public Luna<Screen>
|
||||
{
|
||||
public:
|
||||
LunaScreen() { LUA->Register( Register ); }
|
||||
static int GetNextScreen( T* p, lua_State *L ) { lua_pushstring(L, p->GetNextScreen() ); return 1; }
|
||||
static int lockinput( T* p, lua_State *L ) { p->SetLockInputSecs(FArg(1)); return 0; }
|
||||
|
||||
@@ -293,13 +292,13 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void Register( Lua *L )
|
||||
LunaScreen()
|
||||
{
|
||||
LUA->Register( Register );
|
||||
|
||||
ADD_METHOD( GetNextScreen );
|
||||
ADD_METHOD( PostScreenMessage );
|
||||
ADD_METHOD( lockinput );
|
||||
|
||||
Luna<T>::Register( L );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -2634,16 +2634,15 @@ void ScreenGameplay::SaveReplay()
|
||||
class LunaScreenGameplay: public Luna<ScreenGameplay>
|
||||
{
|
||||
public:
|
||||
LunaScreenGameplay() { LUA->Register( Register ); }
|
||||
|
||||
static int GetNextCourseSong( T* p, lua_State *L ) { p->GetNextCourseSong()->PushSelf(L); return 1; }
|
||||
static int Center1Player( T* p, lua_State *L ) { lua_pushboolean( L, p->Center1Player() ); return 1; }
|
||||
static void Register( Lua *L )
|
||||
|
||||
LunaScreenGameplay()
|
||||
{
|
||||
LUA->Register( Register );
|
||||
|
||||
ADD_METHOD( GetNextCourseSong );
|
||||
ADD_METHOD( Center1Player );
|
||||
|
||||
Luna<T>::Register( L );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1250,14 +1250,13 @@ void ScreenOptions::MenuUpDown( const InputEventPlus &input, int iDir )
|
||||
class LunaScreenOptions: public Luna<ScreenOptions>
|
||||
{
|
||||
public:
|
||||
LunaScreenOptions() { LUA->Register( Register ); }
|
||||
|
||||
static int GetCurrentRow( T* p, lua_State *L ) { lua_pushnumber( L, p->GetCurrentRow(Enum::Check<PlayerNumber>(L, 1)) ); return 1; }
|
||||
static void Register( Lua *L )
|
||||
{
|
||||
ADD_METHOD( GetCurrentRow );
|
||||
|
||||
Luna<T>::Register( L );
|
||||
LunaScreenOptions()
|
||||
{
|
||||
LUA->Register( Register );
|
||||
|
||||
ADD_METHOD( GetCurrentRow );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -185,14 +185,13 @@ void ScreenPlayerOptions::UpdateDisqualified( int row, PlayerNumber pn )
|
||||
class LunaScreenPlayerOptions: public Luna<ScreenPlayerOptions>
|
||||
{
|
||||
public:
|
||||
LunaScreenPlayerOptions() { LUA->Register( Register ); }
|
||||
|
||||
static int GetGoToOptions( T* p, lua_State *L ) { lua_pushboolean( L, p->GetGoToOptions() ); return 1; }
|
||||
static void Register( Lua *L )
|
||||
{
|
||||
ADD_METHOD( GetGoToOptions );
|
||||
|
||||
Luna<T>::Register( L );
|
||||
LunaScreenPlayerOptions()
|
||||
{
|
||||
LUA->Register( Register );
|
||||
|
||||
ADD_METHOD( GetGoToOptions );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1028,14 +1028,13 @@ void ScreenSelectMusic::AfterMusicChange()
|
||||
class LunaScreenSelectMusic: public Luna<ScreenSelectMusic>
|
||||
{
|
||||
public:
|
||||
LunaScreenSelectMusic() { LUA->Register( Register ); }
|
||||
|
||||
static int GetGoToOptions( T* p, lua_State *L ) { lua_pushboolean( L, p->GetGoToOptions() ); return 1; }
|
||||
static void Register( Lua *L )
|
||||
{
|
||||
ADD_METHOD( GetGoToOptions );
|
||||
|
||||
Luna<T>::Register( L );
|
||||
LunaScreenSelectMusic()
|
||||
{
|
||||
LUA->Register( Register );
|
||||
|
||||
ADD_METHOD( GetGoToOptions );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -351,11 +351,9 @@ void ScreenWithMenuElementsSimple::MenuBack( const InputEventPlus &input )
|
||||
class LunaScreenWithMenuElements: public Luna<ScreenWithMenuElements>
|
||||
{
|
||||
public:
|
||||
LunaScreenWithMenuElements() { LUA->Register( Register ); }
|
||||
|
||||
static void Register( Lua *L )
|
||||
LunaScreenWithMenuElements()
|
||||
{
|
||||
Luna<T>::Register( L );
|
||||
LUA->Register( Register );
|
||||
}
|
||||
};
|
||||
|
||||
@@ -364,11 +362,9 @@ LUA_REGISTER_DERIVED_CLASS( ScreenWithMenuElements, Screen )
|
||||
class LunaScreenWithMenuElementsSimple: public Luna<ScreenWithMenuElementsSimple>
|
||||
{
|
||||
public:
|
||||
LunaScreenWithMenuElementsSimple() { LUA->Register( Register ); }
|
||||
|
||||
static void Register( Lua *L )
|
||||
LunaScreenWithMenuElementsSimple()
|
||||
{
|
||||
Luna<T>::Register( L );
|
||||
LUA->Register( Register );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user