Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- c = 10
- function test()
- local a, b, c, d = 1, 2, 1, 4
- return function()
- print(a, b, c, d, e)
- return a+b+c+d
- end
- end
- local function ddump(f)
- local i, t = 2, {}
- local a, b = debug.getupvalue (test(), i)
- while (a) do
- t[i] = b
- i = i+1
- a, b = debug.getupvalue (test(), i)
- end
- return t, string.dump(f)
- end
- local function lload(t, d)
- local f = assert(load(d))
- for k,v in pairs(t) do
- debug.setupvalue(f, k, v)
- end
- return f
- end
- local t, d = ddump(test())
- local f = lload(t, d)
- c = 11
- f(1,2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement