github.com/hirochachacha/plua@v0.0.0-20170217012138-c82f520cc725/stdlib/debug/testdata/getupvalue.lua (about) 1 local a,b,c = 1,2,3 2 local function foo(a) b = a; return c end 3 assert(debug.getupvalue(foo, 0) == nil) 4 k, v = debug.getupvalue(foo, 1) 5 assert(k == "b" and v == 2) 6 k, v = debug.getupvalue(foo, 2) 7 assert(k == "c" and v == 3) 8 assert(debug.getupvalue(foo, 3) == nil)