Added WheelItemBase:IsLoaded lua function and associated error.

This commit is contained in:
Kyzentun
2014-08-29 20:06:50 -06:00
parent ef2254a4c4
commit 6757ab0c8c
4 changed files with 43 additions and 11 deletions
+30 -4
View File
@@ -87,11 +87,36 @@ void WheelItemBase::DrawPrimitives()
class LunaWheelItemBase: public Luna<WheelItemBase>
{
public:
DEFINE_METHOD( GetColor, GetColor() )
DEFINE_METHOD( GetText, GetText() )
#define IS_LOADED_CHECK \
if(!p->IsLoaded()) \
{ \
luaL_error(L, "Wheel item is not loaded yet. Use WheelItem:IsLoaded() to check."); \
}
static int GetColor(T* p, lua_State *L)
{
IS_LOADED_CHECK;
LuaHelpers::Push(L, p->GetColor());
return 1;
}
static int GetText(T* p, lua_State *L)
{
IS_LOADED_CHECK;
LuaHelpers::Push(L, p->GetText());
return 1;
}
static int GetType( T* p, lua_State *L ) {
lua_pushnumber( L, p->GetType() );
static int GetType(T* p, lua_State *L)
{
IS_LOADED_CHECK;
lua_pushnumber(L, p->GetType());
return 1;
}
static int IsLoaded(T* p, lua_State *L)
{
lua_pushboolean(L, p->IsLoaded());
return 1;
}
@@ -100,6 +125,7 @@ public:
ADD_METHOD( GetColor );
ADD_METHOD( GetText );
ADD_METHOD( GetType );
ADD_METHOD( IsLoaded );
}
};
LUA_REGISTER_DERIVED_CLASS( WheelItemBase, ActorFrame )