Skip to content

Commit 904b05b

Browse files
p-ouelletteSmallJoker
authored andcommittedOct 23, 2019
Allow calling ItemStack with no arguments (#8783)
1 parent 524442f commit 904b05b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎src/script/lua_api/l_item.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,9 @@ ItemStack& LuaItemStack::getItem()
414414
int LuaItemStack::create_object(lua_State *L)
415415
{
416416
NO_MAP_LOCK_REQUIRED;
417-
ItemStack item = read_item(L, 1, getGameDef(L)->idef());
417+
ItemStack item;
418+
if (!lua_isnone(L, 1))
419+
item = read_item(L, 1, getGameDef(L)->idef());
418420
LuaItemStack *o = new LuaItemStack(item);
419421
*(void **)(lua_newuserdata(L, sizeof(void *))) = o;
420422
luaL_getmetatable(L, className);

0 commit comments

Comments
 (0)