lua-users home
lua-l archive

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

 I'm working on a remote Lua debugger (tcp/ip based, portable, works with
plain Lua 5.x... i'll announce a public alpha in a few weeks).  Really I've
learned more about Lua in stepping thru code in the debugger that I would
have imagined.  I came across some interestingly named local variables
returned from get_local()...

	"(for index)"
	"(for limit)"
	"(for stop)"

 This is interesting info, but not as user friendly as seeing the actual
parameter passed to 'for'.  My question is how can I derive the actual
parameters passed to 'for' to associate with the index, limit, and stop
values?  For example:

  for x=1,w do
	-- some stuff

 I'd rather hide "(for index)" and see "x" in the locals list.  As it is now
I only see "x" when I'm not stepping on the 'for' line... so I learned
something... "x" is deleted and reallocated on each loop.  Still this isn't
very helpful when you have nested loops which in that case you get multiple
"(for limit)" locals and the user is left confused.

 I'm thinking that I can maybe count that the first local after "(for xxx)"
hidden locals would always be the named index, but that sounds like a hack
to me.  Also this doesn't solve "(for limit)" and "(for stop)". I'm trying
to avoid parsing Lua scripts to find info not available thru the debug api,
but it seems like it's inevitable.

 Hope I made sense. =)

  Tom Spilman
  Co-owner | Programmer