mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +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
|
@ -275,7 +275,7 @@ bool MetaDataRef::handleFromTable(lua_State *L, int table, Metadata *meta)
|
|||
lua_pushnil(L);
|
||||
while (lua_next(L, fieldstable) != 0) {
|
||||
// key at index -2 and value at index -1
|
||||
std::string name = lua_tostring(L, -2);
|
||||
std::string name = readParam<std::string>(L, -2);
|
||||
size_t cl;
|
||||
const char *cs = lua_tolstring(L, -1, &cl);
|
||||
meta->setString(name, std::string(cs, cl));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue