lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

I am having the following scenario

file1.lua

local a = 1

file2. lua

local b = 2
local c = 3

file3.lua 

loadfile(file1.lua)
loadfile(file2.lua)

func1()

f = a + b
--Here while in the debug session in C++ i am trying to get all the available local variables to this function. which are a,b,c right
end

C++ Code . 
//This is the Lua Debug Hook.
void DebugHookRoutine(lua_State *L, lua_Debug *ar)
{
...
get_all_locals(lua_State *L,lua_Debug *ar);
}


void get_all_locals(lua_State *L,lua_Debug *ar)
{

int nVars = 1 // till 
for (nVars = 1; nVars < 50; nVars++)
{
const char*  varPtr =  lua_getlocal(L, ar, nVars ) //All i am getting is (*temporary)
...
}
}

Would i be able to get local values which are available till the point of execution of current lua file and if so how?

Thanks
Sivan