Tell on_punch to expect a return value
authorDuane Robertson <duane@duanerobertson.com>
Tue, 31 Jan 2017 04:37:04 +0000 (22:37 -0600)
committersapier <sapier at gmx dot net>
Wed, 1 Feb 2017 21:13:49 +0000 (22:13 +0100)
The return value should be interpreted as a boolean saying whether
the lua on_punch function handled damage or the system needs to.

src/script/cpp_api/s_entity.cpp

index fcd8dd4a07033c8ba18a9a599c65d58c9bf59c32..9e2193970c28d45b61abf101cd5f8b05f28a28a8 100644 (file)
@@ -254,7 +254,7 @@ bool ScriptApiEntity::luaentity_Punch(u16 id,
        lua_pushnumber(L, damage);
 
        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);
        lua_pop(L, 2); // Pop object and error handler