Skip to content

Commit

Permalink
fix(server): adding and removing door properties
Browse files Browse the repository at this point in the history
Incorrect nil type-check when adding a new property.
Allow empty string to remove a property.
Resolves #146.
  • Loading branch information
thelindat committed Jun 19, 2023
1 parent 20f1ee8 commit 61bc18c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ exports('editDoor', function(id, data)
local t1 = type(current)
local t2 = type(v)

if t1 ~= nil and t1 ~= t2 then
if t1 ~= 'nil' and v ~= '' and t1 ~= t2 then
error(("Expected '%s' for door.%s, received %s (%s)"):format(t1, k, t2, v))
end

door[k] = v
door[k] = v ~= '' and v or nil
end
end

Expand Down

0 comments on commit 61bc18c

Please sign in to comment.