diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-01-24 12:37:52 -0800 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-01-24 12:38:09 -0800 |
| commit | d173e9ae88380bb1217b3f775e6c3cec71a6606c (patch) | |
| tree | a385dbe31e3a71cae667c64458a837efc25d5b3d /nomsu.lua | |
| parent | 566b7d09c860bb719e69c54ea0618da7c90c2dff (diff) | |
Fixed id for nil/NaN and cleaned up collection metatable stuff.
Diffstat (limited to 'nomsu.lua')
| -rw-r--r-- | nomsu.lua | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1430,9 +1430,16 @@ do self.write_err = function(self, ...) return io.stderr:write(...) end + local NaN_surrogate = { } + local nil_surrogate = { } self.ids = setmetatable({ }, { __mode = "k", __index = function(self, key) + if key == nil then + return self[nil_surrogate] + elseif key ~= key then + return self[NaN_surrogate] + end local id = new_uuid() self[key] = id return id |
