Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add debug_get("name") function
  • Loading branch information
sorear committed Nov 6, 2011
1 parent f9e1bb5 commit d1dbce3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lua/runtime/Init.lua
Expand Up @@ -17,6 +17,20 @@ function table_clone (target)
return dest;
end

function debug_get (var)
local i = 1
while true do
local j = 1
while true do
local k, v = debug.getlocal(i, j)
if k == nil then break end
if k == var then return v end
j = j + 1;
end
i = i + 1
end
end

function table_desc (target)
if (type(target) == "nil") then
print("table_desc target was nil");
Expand Down

0 comments on commit d1dbce3

Please sign in to comment.