Comparison

util/debug.lua @ 4465:41c4252526bd

util.debug: Adjust level within get_locals_table() to account for the additional depth of this function itself
author Matthew Wild <mwild1@gmail.com>
date Fri, 13 Jan 2012 15:46:36 +0000
parent 4418:70b5e533325d
child 4519:510f4ba7080f
child 4680:8834f220ab91
comparison
equal deleted inserted replaced
4464:b0574fc78a0a 4465:41c4252526bd
7 pass = true; 7 pass = true;
8 pwd = true; 8 pwd = true;
9 }; 9 };
10 10
11 local function get_locals_table(level) 11 local function get_locals_table(level)
12 level = level + 1; -- Skip this function itself
12 local locals = {}; 13 local locals = {};
13 for local_num = 1, math.huge do 14 for local_num = 1, math.huge do
14 local name, value = debug.getlocal(level, local_num); 15 local name, value = debug.getlocal(level, local_num);
15 if not name then break; end 16 if not name then break; end
16 table.insert(locals, { name = name, value = value }); 17 table.insert(locals, { name = name, value = value });