diff --git a/src/luascript.cpp b/src/luascript.cpp index b55a21e29c..0bde307b55 100644 --- a/src/luascript.cpp +++ b/src/luascript.cpp @@ -2691,6 +2691,7 @@ void LuaScriptInterface::registerFunctions() registerMethod("ItemType", "isMagicField", LuaScriptInterface::luaItemTypeIsMagicField); registerMethod("ItemType", "isUseable", LuaScriptInterface::luaItemTypeIsUseable); registerMethod("ItemType", "isPickupable", LuaScriptInterface::luaItemTypeIsPickupable); + registerMethod("ItemType", "isKey", LuaScriptInterface::luaItemTypeIsKey); registerMethod("ItemType", "getType", LuaScriptInterface::luaItemTypeGetType); registerMethod("ItemType", "getGroup", LuaScriptInterface::luaItemTypeGetGroup); @@ -11899,6 +11900,18 @@ int LuaScriptInterface::luaItemTypeIsPickupable(lua_State* L) return 1; } +int LuaScriptInterface::luaItemTypeIsKey(lua_State* L) +{ + // itemType:isKey() + const ItemType* itemType = getUserdata(L, 1); + if (itemType) { + pushBoolean(L, itemType->isKey()); + } else { + lua_pushnil(L); + } + return 1; +} + int LuaScriptInterface::luaItemTypeGetType(lua_State* L) { // itemType:getType()