1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-12-22 07:38:48 -05:00

Tell on_punch to expect a return value

The return value should be interpreted as a boolean saying whether
the lua on_punch function handled damage or the system needs to.
This commit is contained in:
Duane Robertson 2017-01-30 22:37:04 -06:00 committed by sapier
parent 326cc5df74
commit 3b9ae409c7

View File

@ -254,7 +254,7 @@ bool ScriptApiEntity::luaentity_Punch(u16 id,
lua_pushnumber(L, damage); lua_pushnumber(L, damage);
setOriginFromTable(object); setOriginFromTable(object);
PCALL_RES(lua_pcall(L, 6, 0, error_handler)); PCALL_RES(lua_pcall(L, 6, 1, error_handler));
bool retval = lua_toboolean(L, -1); bool retval = lua_toboolean(L, -1);
lua_pop(L, 2); // Pop object and error handler lua_pop(L, 2); // Pop object and error handler