MAP_LOCK_REQUIRED;
MetaDataRef *ref = checkobject(L, 1);
- std::string name = lua_tostring(L, 2);
+ std::string name = luaL_checkstring(L, 2);
Metadata *meta = ref->getmeta(false);
if (meta == NULL) {
MAP_LOCK_REQUIRED;
MetaDataRef *ref = checkobject(L, 1);
- std::string name = lua_tostring(L, 2);
- int a = lua_tointeger(L, 3);
+ std::string name = luaL_checkstring(L, 2);
+ int a = luaL_checkint(L, 3);
std::string str = itos(a);
Metadata *meta = ref->getmeta(true);
MAP_LOCK_REQUIRED;
MetaDataRef *ref = checkobject(L, 1);
- std::string name = lua_tostring(L, 2);
+ std::string name = luaL_checkstring(L, 2);
Metadata *meta = ref->getmeta(false);
if (meta == NULL) {
MAP_LOCK_REQUIRED;
MetaDataRef *ref = checkobject(L, 1);
- std::string name = lua_tostring(L, 2);
- float a = lua_tonumber(L, 3);
+ std::string name = luaL_checkstring(L, 2);
+ float a = luaL_checknumber(L, 3);
std::string str = ftos(a);
Metadata *meta = ref->getmeta(true);
lua_pushnil(L);
while (lua_next(L, inventorytable) != 0) {
// key at index -2 and value at index -1
- std::string name = lua_tostring(L, -2);
+ std::string name = luaL_checkstring(L, -2);
read_inventory_list(L, -1, inv, name.c_str(), getServer(L));
lua_pop(L, 1); // Remove value, keep key for next iteration
}