Browse Source

Auto-delete MetaData when = 0 (#8770)

Port of Old MT commit 808eb4c571
From: Lejo <Lejo_1@web.de>
Date: Sat, 2 May 2020 12:57:04 +0200
master
OldCoder 2 months ago
parent
commit
abbae3ff71
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      src/script/lua_api/l_metadata.cpp

+ 6
- 2
src/script/lua_api/l_metadata.cpp View File

@@ -153,7 +153,9 @@ int MetaDataRef::l_set_int(lua_State *L)
MetaDataRef *ref = checkobject(L, 1);
std::string name = luaL_checkstring(L, 2);
int a = luaL_checkint(L, 3);
std::string str = itos(a);
std::string str;
if (a != 0)
str = itos(a);

Metadata *meta = ref->getmeta(true);
if (meta == NULL || str == meta->getString(name))
@@ -191,7 +193,9 @@ int MetaDataRef::l_set_float(lua_State *L)
MetaDataRef *ref = checkobject(L, 1);
std::string name = luaL_checkstring(L, 2);
float a = readParam<float>(L, 3);
std::string str = ftos(a);
std::string str;
if (a != 0)
str = ftos(a);

Metadata *meta = ref->getmeta(true);
if (meta == NULL || str == meta->getString(name))


Loading…
Cancel
Save