projects
/
oweals
/
minetest.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
524442f
)
Allow calling ItemStack with no arguments (#8783)
author
Paul Ouellette
<oue.paul18@gmail.com>
Wed, 23 Oct 2019 17:48:19 +0000
(13:48 -0400)
committer
SmallJoker
<SmallJoker@users.noreply.github.com>
Wed, 23 Oct 2019 17:48:19 +0000
(19:48 +0200)
src/script/lua_api/l_item.cpp
patch
|
blob
|
history
diff --git
a/src/script/lua_api/l_item.cpp
b/src/script/lua_api/l_item.cpp
index f9708b560f4f580bbbd5693702c60ca7ea9fdcdf..a76e5527a17f45ca8b36e48266b82df2a4deb082 100644
(file)
--- a/
src/script/lua_api/l_item.cpp
+++ b/
src/script/lua_api/l_item.cpp
@@
-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);