mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-14 00:55:20 +02:00
Modernize source code: last part (#6285)
* Modernize source code: last par * Use empty when needed * Use emplace_back instead of push_back when needed * For range-based loops * Initializers fixes * constructors, destructors default * c++ C stl includes
This commit is contained in:
@@ -495,28 +495,29 @@ int ModApiInventory::l_get_inventory(lua_State *L)
|
||||
v3s16 pos = check_v3s16(L, -1);
|
||||
loc.setNodeMeta(pos);
|
||||
|
||||
if(getServer(L)->getInventory(loc) != NULL)
|
||||
if (getServer(L)->getInventory(loc) != NULL)
|
||||
InvRef::create(L, loc);
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
} else {
|
||||
NO_MAP_LOCK_REQUIRED;
|
||||
if(type == "player"){
|
||||
std::string name = checkstringfield(L, 1, "name");
|
||||
loc.setPlayer(name);
|
||||
} else if(type == "detached"){
|
||||
std::string name = checkstringfield(L, 1, "name");
|
||||
loc.setDetached(name);
|
||||
}
|
||||
|
||||
if(getServer(L)->getInventory(loc) != NULL)
|
||||
InvRef::create(L, loc);
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
// END NO_MAP_LOCK_REQUIRED;
|
||||
}
|
||||
|
||||
NO_MAP_LOCK_REQUIRED;
|
||||
if (type == "player") {
|
||||
std::string name = checkstringfield(L, 1, "name");
|
||||
loc.setPlayer(name);
|
||||
} else if (type == "detached") {
|
||||
std::string name = checkstringfield(L, 1, "name");
|
||||
loc.setDetached(name);
|
||||
}
|
||||
|
||||
if (getServer(L)->getInventory(loc) != NULL)
|
||||
InvRef::create(L, loc);
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
// END NO_MAP_LOCK_REQUIRED;
|
||||
|
||||
}
|
||||
|
||||
// create_detached_inventory_raw(name, [player_name])
|
||||
|
Reference in New Issue
Block a user