add lua bindings

This commit is contained in:
Chris Danford
2005-02-21 17:20:11 +00:00
parent b960e51f42
commit a0ebb13fec
2 changed files with 31 additions and 0 deletions
+27
View File
@@ -1129,6 +1129,33 @@ void Course::GetAllCachedTrails( vector<Trail *> &out )
}
}
// lua start
#include "LuaBinding.h"
template<class T>
class LunaCourse : public Luna<T>
{
public:
LunaCourse() { LUA->Register( Register ); }
static int GetPlayMode( T* p, lua_State *L ) { lua_pushnumber(L, p->GetPlayMode() ); return 1; }
static int GetFullDisplayTitle( T* p, lua_State *L ) { lua_pushstring(L, p->GetFullDisplayTitle() ); return 1; }
static int GetFullTranslitTitle( T* p, lua_State *L ) { lua_pushstring(L, p->GetFullTranslitTitle() ); return 1; }
static void Register(lua_State *L)
{
ADD_METHOD( GetPlayMode )
ADD_METHOD( GetFullDisplayTitle )
ADD_METHOD( GetFullTranslitTitle )
Luna<T>::Register( L );
}
};
LUA_REGISTER_CLASS( Course )
// lua end
/*
* (c) 2001-2004 Chris Danford, Glenn Maynard
* All rights reserved.
+4
View File
@@ -14,6 +14,7 @@ struct SongOptions;
class Song;
class Steps;
class Profile;
struct lua_State;
enum CourseEntryType
{
@@ -153,6 +154,9 @@ public:
const CourseEntry *FindFixedSong( const Song *pSong ) const;
// Lua
void PushSelf( lua_State *L );
private:
bool GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail ) const;
bool GetTrailSorted( StepsType st, CourseDifficulty cd, Trail &trail ) const;