Skip to content

Commit

Permalink
Move Item.getType to Lua core lib
Browse files Browse the repository at this point in the history
  • Loading branch information
marksamman committed Apr 17, 2015
1 parent 4c86a17 commit bc1ba65
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
4 changes: 4 additions & 0 deletions data/lib/core/item.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
function Item.getType(self)
return ItemType(self.itemid)
end

function Item.isContainer(self)
return false
end
Expand Down
15 changes: 0 additions & 15 deletions src/luascript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2051,7 +2051,6 @@ void LuaScriptInterface::registerFunctions()
registerMethod("Item", "getTopParent", LuaScriptInterface::luaItemGetTopParent);

registerMethod("Item", "getId", LuaScriptInterface::luaItemGetId);
registerMethod("Item", "getType", LuaScriptInterface::luaItemGetType);

registerMethod("Item", "clone", LuaScriptInterface::luaItemClone);
registerMethod("Item", "split", LuaScriptInterface::luaItemSplit);
Expand Down Expand Up @@ -6355,20 +6354,6 @@ int LuaScriptInterface::luaItemGetId(lua_State* L)
return 1;
}

int LuaScriptInterface::luaItemGetType(lua_State* L)
{
// item:getType()
Item* item = getUserdata<Item>(L, 1);
if (item) {
const ItemType& it = Item::items[item->getID()];
pushUserdata<const ItemType>(L, &it);
setMetatable(L, -1, "ItemType");
} else {
lua_pushnil(L);
}
return 1;
}

int LuaScriptInterface::luaItemClone(lua_State* L)
{
// item:clone()
Expand Down
1 change: 0 additions & 1 deletion src/luascript.h
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,6 @@ class LuaScriptInterface
static int luaItemGetTopParent(lua_State* L);

static int luaItemGetId(lua_State* L);
static int luaItemGetType(lua_State* L);

static int luaItemClone(lua_State* L);
static int luaItemSplit(lua_State* L);
Expand Down

0 comments on commit bc1ba65

Please sign in to comment.