add Lua bindings
This commit is contained in:
@@ -26,7 +26,7 @@ XToString( RadarCategory );
|
||||
XToThemedString( RadarCategory, NUM_RADAR_CATEGORIES );
|
||||
|
||||
|
||||
void LuaStepsType(lua_State* L)
|
||||
static void LuaStepsType(lua_State* L)
|
||||
{
|
||||
FOREACH_StepsType( st )
|
||||
{
|
||||
@@ -50,7 +50,7 @@ static const CString PlayModeNames[NUM_PLAY_MODES] = {
|
||||
XToString( PlayMode );
|
||||
XToThemedString( PlayMode, NUM_PLAY_MODES );
|
||||
StringToX( PlayMode );
|
||||
void LuaPlayMode(lua_State* L)
|
||||
static void LuaPlayMode(lua_State* L)
|
||||
{
|
||||
FOREACH_PlayMode( pm )
|
||||
{
|
||||
@@ -281,7 +281,7 @@ static const CString GoalTypeNames[NUM_GOAL_TYPES] = {
|
||||
};
|
||||
XToString( GoalType );
|
||||
StringToX( GoalType );
|
||||
void LuaGoalType(lua_State* L)
|
||||
static void LuaGoalType(lua_State* L)
|
||||
{
|
||||
FOREACH_GoalType( gt )
|
||||
{
|
||||
@@ -302,7 +302,7 @@ static const CString EditMenuActionNames[NUM_EDIT_MENU_ACTIONS] = {
|
||||
};
|
||||
XToString( EditMenuAction );
|
||||
StringToX( EditMenuAction );
|
||||
void LuaEditMenuAction(lua_State* L)
|
||||
static void LuaEditMenuAction(lua_State* L)
|
||||
{
|
||||
FOREACH_EditMenuAction( ema )
|
||||
{
|
||||
|
||||
@@ -1804,8 +1804,15 @@ public:
|
||||
static int GetCurrentSong( T* p, lua_State *L ) { if(p->m_pCurSong) p->m_pCurSong->PushSelf(L); else lua_pushnil(L); return 1; }
|
||||
static int SetCurrentSong( T* p, lua_State *L )
|
||||
{
|
||||
if( lua_isnil(L,1) ) { p->m_pCurSong = NULL; }
|
||||
else { Song *pS = Luna<Song>::check(L,1); p->m_pCurSong = pS; }
|
||||
if( lua_isnil(L,1) )
|
||||
{
|
||||
p->m_pCurSong = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
Song *pS = Luna<Song>::check(L,1);
|
||||
p->m_pCurSong = pS;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
static int GetCurrentSteps( T* p, lua_State *L )
|
||||
@@ -1819,9 +1826,8 @@ public:
|
||||
static int SetCurrentSteps( T* p, lua_State *L )
|
||||
{
|
||||
PlayerNumber pn = (PlayerNumber)IArg(1);
|
||||
Steps *pSteps = p->m_pCurSteps[pn];
|
||||
if( lua_isnil(L,2) ) { p->m_pCurSteps[pn] = NULL; }
|
||||
else { Song *pS = Luna<Song>::check(L,2); p->m_pCurSteps[pn] = pS; }
|
||||
else { Steps *pS = Luna<Steps>::check(L,2); p->m_pCurSteps[pn] = pS; }
|
||||
return 0;
|
||||
}
|
||||
static int GetCurrentCourse( T* p, lua_State *L ) { if(p->m_pCurCourse) p->m_pCurCourse->PushSelf(L); else lua_pushnil(L); return 1; }
|
||||
@@ -1842,6 +1848,8 @@ public:
|
||||
ADD_METHOD( ApplyGameCommand )
|
||||
ADD_METHOD( GetCurrentSong )
|
||||
ADD_METHOD( SetCurrentSong )
|
||||
ADD_METHOD( GetCurrentSteps )
|
||||
ADD_METHOD( SetCurrentSteps )
|
||||
ADD_METHOD( GetCurrentCourse )
|
||||
ADD_METHOD( SetCurrentCourse )
|
||||
ADD_METHOD( SetTemporaryEventMode )
|
||||
|
||||
@@ -1252,12 +1252,14 @@ public:
|
||||
CreateTableFromArray<Course*>( v, L );
|
||||
return 1;
|
||||
}
|
||||
static int FindSong( T* p, lua_State *L ) { Song *pS = p->FindSong(SArg(1)); if(pS) pS->PushSelf(L); else lua_pushnil(L); return 1; }
|
||||
static int FindCourse( T* p, lua_State *L ) { Course *pC = p->FindCourse(SArg(1)); if(pC) pC->PushSelf(L); else lua_pushnil(L); return 1; }
|
||||
|
||||
static void Register(lua_State *L)
|
||||
{
|
||||
ADD_METHOD( GetAllSongs )
|
||||
ADD_METHOD( GetAllCourses )
|
||||
ADD_METHOD( FindSong )
|
||||
ADD_METHOD( FindCourse )
|
||||
Luna<T>::Register( L );
|
||||
|
||||
|
||||
@@ -337,11 +337,13 @@ public:
|
||||
LunaSteps() { LUA->Register( Register ); }
|
||||
|
||||
static int GetStepsType( T* p, lua_State *L ) { lua_pushnumber(L, p->m_StepsType ); return 1; }
|
||||
static int GetDifficulty( T* p, lua_State *L ) { lua_pushnumber(L, p->GetDifficulty() ); return 1; }
|
||||
static int GetDescription( T* p, lua_State *L ) { lua_pushstring(L, p->GetDescription() ); return 1; }
|
||||
|
||||
static void Register(lua_State *L)
|
||||
{
|
||||
ADD_METHOD( GetStepsType )
|
||||
ADD_METHOD( GetDifficulty )
|
||||
ADD_METHOD( GetDescription )
|
||||
Luna<T>::Register( L );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user