mirror of
https://github.com/kikito/inspect.lua.git
synced 2024-12-15 14:34:21 +00:00
Store used external function in local scope
Fix bug like this: function fn(...) setmetatable = {...} return setmetatable end print(inspect(fn(1,2,3))) -- error, attempt to call a table value (global 'setmetatable')
This commit is contained in:
parent
96a1e6cc6f
commit
805ea9e88d
11
inspect.lua
11
inspect.lua
@ -28,6 +28,17 @@ local inspect ={
|
||||
]]
|
||||
}
|
||||
|
||||
local pairs = pairs
|
||||
local ipairs = ipairs
|
||||
local type = type
|
||||
local math = math
|
||||
local tostring = tostring
|
||||
local rawset = rawset
|
||||
local next = next
|
||||
local getmetatable = getmetatable
|
||||
local table = table
|
||||
local setmetatable = setmetatable
|
||||
|
||||
inspect.KEY = setmetatable({}, {__tostring = function() return 'inspect.KEY' end})
|
||||
inspect.METATABLE = setmetatable({}, {__tostring = function() return 'inspect.METATABLE' end})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user