mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-16 18:01:40 +00:00
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
This commit is contained in:
parent
227c71eb76
commit
eef62c82a2
35 changed files with 247 additions and 154 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue