Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow calling ItemStack with no arguments (#8783)
  • Loading branch information
p-ouellette authored and SmallJoker committed Oct 23, 2019
1 parent 524442f commit 904b05b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/script/lua_api/l_item.cpp
Expand Up @@ -414,7 +414,9 @@ ItemStack& LuaItemStack::getItem()
int LuaItemStack::create_object(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
ItemStack item = read_item(L, 1, getGameDef(L)->idef());
ItemStack item;
if (!lua_isnone(L, 1))
item = read_item(L, 1, getGameDef(L)->idef());
LuaItemStack *o = new LuaItemStack(item);
*(void **)(lua_newuserdata(L, sizeof(void *))) = o;
luaL_getmetatable(L, className);
Expand Down

0 comments on commit 904b05b

Please sign in to comment.