diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-06-30 17:11:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-30 17:11:38 +0200 |
commit | eef62c82a2e58700fc1216b0b8c03e421bc77995 (patch) | |
tree | 4c49e659069036cb53d69535dc33d33f29d963f4 /src/script/cpp_api/s_node.cpp | |
parent | 227c71eb76e019873b30e2d3893b68307d51d58f (diff) | |
download | minetest-eef62c82a2e58700fc1216b0b8c03e421bc77995.tar.gz minetest-eef62c82a2e58700fc1216b0b8c03e421bc77995.tar.bz2 minetest-eef62c82a2e58700fc1216b0b8c03e421bc77995.zip |
Modernize lua read (part 2 & 3): C++ templating assurance (#7410)
* Modernize lua read (part 2 & 3): C++ templating assurance
Implement the boolean reader
Implement the string reader
Also remove unused & unimplemented script_error_handler
Add a reader with default value
Diffstat (limited to 'src/script/cpp_api/s_node.cpp')
-rw-r--r-- | src/script/cpp_api/s_node.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/script/cpp_api/s_node.cpp b/src/script/cpp_api/s_node.cpp index 11c08811f..719f53a6b 100644 --- a/src/script/cpp_api/s_node.cpp +++ b/src/script/cpp_api/s_node.cpp @@ -192,7 +192,7 @@ bool ScriptApiNode::node_on_flood(v3s16 p, MapNode node, MapNode newnode) pushnode(L, newnode, ndef); PCALL_RES(lua_pcall(L, 3, 1, error_handler)); lua_remove(L, error_handler); - return (bool) lua_isboolean(L, -1) && (bool) lua_toboolean(L, -1); + return readParam<bool>(L, -1, false); } void ScriptApiNode::node_after_destruct(v3s16 p, MapNode node) @@ -231,7 +231,7 @@ bool ScriptApiNode::node_on_timer(v3s16 p, MapNode node, f32 dtime) lua_pushnumber(L,dtime); PCALL_RES(lua_pcall(L, 2, 1, error_handler)); lua_remove(L, error_handler); - return (bool) lua_isboolean(L, -1) && (bool) lua_toboolean(L, -1); + return readParam<bool>(L, -1, false); } void ScriptApiNode::node_on_receive_fields(v3s16 p, |