diff --git a/stepmania/src/HighScore.cpp b/stepmania/src/HighScore.cpp index d3abf4bcde..30896e2c95 100644 --- a/stepmania/src/HighScore.cpp +++ b/stepmania/src/HighScore.cpp @@ -373,6 +373,29 @@ void Screenshot::LoadFromNode( const XNode* pNode ) highScore.LoadFromNode( pHighScore ); } +// lua start +#include "LuaBinding.h" + +class LunaHighScore: public Luna +{ +public: + LunaHighScore() { LUA->Register( Register ); } + + static int GetName( T* p, lua_State *L ) { lua_pushstring(L, p->GetName() ); return 1; } + static int GetScore( T* p, lua_State *L ) { lua_pushnumber(L, p->GetScore() ); return 1; } + + static void Register(lua_State *L) + { + ADD_METHOD( GetName ); + ADD_METHOD( GetScore ); + + Luna::Register( L ); + } +}; + +LUA_REGISTER_CLASS( HighScore ) +// lua end + /* * (c) 2004 Chris Danford * All rights reserved. diff --git a/stepmania/src/HighScore.h b/stepmania/src/HighScore.h index 0cecc2e43c..db005c9831 100644 --- a/stepmania/src/HighScore.h +++ b/stepmania/src/HighScore.h @@ -10,6 +10,7 @@ #include "RageUtil_AutoPtr.h" class XNode; +struct lua_State; struct HighScoreImpl; struct HighScore @@ -59,6 +60,9 @@ struct HighScore void LoadFromNode( const XNode* pNode ); RString GetDisplayName() const; + + // Lua + void PushSelf( lua_State *L ); private: HiddenPtr m_Impl; };