summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
Diffstat (limited to 'src/script')
-rw-r--r--src/script/lua_api/l_object.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index 6f61ab55c..c7a31d048 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -1202,9 +1202,10 @@ int ObjectRef::l_set_attribute(lua_State *L)
}
std::string attr = luaL_checkstring(L, 2);
- std::string value = luaL_checkstring(L, 3);
-
- if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER) {
+ if (lua_isnil(L, 3)) {
+ co->removeExtendedAttribute(attr);
+ } else {
+ std::string value = luaL_checkstring(L, 3);
co->setExtendedAttribute(attr, value);
}
return 1;