diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index 1adb9f80f4..56bbb79eb7 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -1129,6 +1129,33 @@ void Course::GetAllCachedTrails( vector &out ) } } + +// lua start +#include "LuaBinding.h" + +template +class LunaCourse : public Luna +{ +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::Register( L ); + } +}; + +LUA_REGISTER_CLASS( Course ) +// lua end + + /* * (c) 2001-2004 Chris Danford, Glenn Maynard * All rights reserved. diff --git a/stepmania/src/Course.h b/stepmania/src/Course.h index adc56a4fff..b0b79fdce0 100644 --- a/stepmania/src/Course.h +++ b/stepmania/src/Course.h @@ -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;