Avoid using addresses of static variables as unique keys

The addresses of static variables may be different for different
instances of Lua, making these instances incompatible if they use
these addresses as unique keys in the registry (or other tables).
This commit is contained in:
Roberto Ierusalimschy
2019-07-19 13:14:06 -03:00
parent 440a5ee78c
commit 3c0d3c6fbe
3 changed files with 17 additions and 16 deletions

View File

@@ -255,6 +255,10 @@ do -- test hook presence in debug info
end
-- hook table has weak keys
assert(getmetatable(debug.getregistry()._HOOKKEY).__mode == 'k')
a = {}; L = nil
local glob = 1
local oldglob = glob