From d07c68cf267104505abcf6c71662546cf5317908 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 6 May 2005 11:59:09 +0000 Subject: [PATCH] lua --- stepmania/src/Trail.cpp | 21 +++++++++++++++++++++ stepmania/src/Trail.h | 4 ++++ 2 files changed, 25 insertions(+) diff --git a/stepmania/src/Trail.cpp b/stepmania/src/Trail.cpp index 23dbb2e7c3..c57e7288fd 100644 --- a/stepmania/src/Trail.cpp +++ b/stepmania/src/Trail.cpp @@ -183,6 +183,27 @@ bool Trail::ContainsSong( Song* pSong ) const return false; } +// lua start +#include "LuaBinding.h" + +template +class LunaTrail : public Luna +{ +public: + LunaTrail() { LUA->Register( Register ); } + + static int GetDifficulty( T* p, lua_State *L ) { lua_pushnumber(L, p->m_CourseDifficulty ); return 1; } + + static void Register(lua_State *L) + { + ADD_METHOD( GetDifficulty ) + Luna::Register( L ); + } +}; + +LUA_REGISTER_CLASS( Trail ) +// lua end + /* * (c) 2001-2004 Chris Danford, Glenn Maynard * All rights reserved. diff --git a/stepmania/src/Trail.h b/stepmania/src/Trail.h index d1d409c214..6e052e6997 100644 --- a/stepmania/src/Trail.h +++ b/stepmania/src/Trail.h @@ -9,6 +9,7 @@ class Song; class Steps; +struct lua_State; struct TrailEntry { @@ -70,6 +71,9 @@ public: void GetDisplayBpms( DisplayBpms &AddTo ); bool IsSecret() const; bool ContainsSong( Song* pSong ) const; + + // Lua + void PushSelf( lua_State *L ); }; #endif