mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
MetaData: restore undocumented set_string behaviour (#14396)
This commit is contained in:
parent
b4be483d3e
commit
fa1d80b53b
2 changed files with 33 additions and 2 deletions
|
@ -115,7 +115,13 @@ int MetaDataRef::l_set_string(lua_State *L)
|
|||
|
||||
MetaDataRef *ref = checkAnyMetadata(L, 1);
|
||||
std::string name = luaL_checkstring(L, 2);
|
||||
auto str = readParam<std::string_view>(L, 3);
|
||||
std::string_view str;
|
||||
if (!lua_isnoneornil(L, 3)) {
|
||||
str = readParam<std::string_view>(L, 3);
|
||||
} else {
|
||||
log_deprecated(L, "Value passed to set_string is nil. This behaviour is"
|
||||
" undocumented and will result in an error in the future.", 1, true);
|
||||
}
|
||||
|
||||
IMetadata *meta = ref->getmeta(!str.empty());
|
||||
if (meta != NULL && meta->setString(name, str))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue