lua bindings

This commit is contained in:
Glenn Maynard
2005-06-25 03:11:16 +00:00
parent 7359405188
commit 0d4dad639d
2 changed files with 10 additions and 0 deletions
+8
View File
@@ -1339,6 +1339,10 @@ public:
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 int GetRandomSong( T* p, lua_State *L ) { Song *pS = p->GetRandomSong(); if(pS) pS->PushSelf(L); else lua_pushnil(L); return 1; }
static int GetRandomCourse( T* p, lua_State *L ){ Course *pC = p->GetRandomCourse(); if(pC) pC->PushSelf(L); else lua_pushnil(L); return 1; }
static int GetNumSongs( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumSongs() ); return 1; }
static int GetNumSongGroups( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumSongGroups() ); return 1; }
static int GetNumCourses( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumCourses() ); return 1; }
static int GetNumCourseGroups( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumCourseGroups() ); return 1; }
static void Register(lua_State *L)
{
@@ -1348,6 +1352,10 @@ public:
ADD_METHOD( FindCourse )
ADD_METHOD( GetRandomSong )
ADD_METHOD( GetRandomCourse )
ADD_METHOD( GetNumSongs )
ADD_METHOD( GetNumSongGroups )
ADD_METHOD( GetNumCourses )
ADD_METHOD( GetNumCourseGroups )
Luna<T>::Register( L );
// Add global singleton if constructed already. If it's not constructed yet,
+2
View File
@@ -512,6 +512,7 @@ public:
static int FindCode( T* p, lua_State *L ) { CString sName = SArg(1); int i = p->FindCode(sName); if( i == -1 ) lua_pushnil(L); else lua_pushnumber(L, i); return 1; }
static int UnlockCode( T* p, lua_State *L ) { int iCode = IArg(1); p->UnlockCode(iCode); return 0; }
static int PreferUnlockCode( T* p, lua_State *L ) { int iCode = IArg(1); p->PreferUnlockCode(iCode); return 0; }
static int GetNumUnlocks( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumUnlocks() ); return 1; }
static int GetSongsUnlockedByCode( T* p, lua_State *L )
{
vector<Song *> apSongs;
@@ -536,6 +537,7 @@ public:
ADD_METHOD( FindCode )
ADD_METHOD( UnlockCode )
ADD_METHOD( PreferUnlockCode )
ADD_METHOD( GetNumUnlocks )
ADD_METHOD( GetSongsUnlockedByCode )
ADD_METHOD( GetStepsUnlockedByCode )
Luna<T>::Register( L );