1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-14 17:15:21 +02: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:
Loïc Blot
2018-06-30 17:11:38 +02:00
committed by GitHub
parent 227c71eb76
commit eef62c82a2
35 changed files with 247 additions and 154 deletions

View File

@@ -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));