Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local test = 'testset'
- function locals()
- local variables = {}
- local idx = 1
- while true do
- local ln, lv = debug.getlocal(2, idx)
- if ln ~= nil then
- variables[ln] = lv
- else
- break
- end
- idx = 1 + idx
- end
- return variables
- end
- local function foo()
- local bar = 'bar'
- print(locals())
- end
- foo()
Advertisement
Add Comment
Please, Sign In to add comment