lua-users home
lua-l archive

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


> How can I go about traversing the LUA stack looking
> for all user defined, global variables (not any
> constants, etc).
> 
> Secondly, is there any way to do syntax checking
> without having to run the scripts?  How do I retrieve
> the errors associated with the script code?  
> 
> I am trying to build a view similar to that of Visual
> Studio where all of the global variables are listed,
> then all of the functions, and their associated member
> variables.

AFAIK, there is no way do see the difference between variables and
constants. There is no constant in Lua, or at least you will have to take special
steps to make variables as constants (see test/readonly.lua).

Also I doubt you can distinguish between user defined and system defined
variables. At least, you can exclude the later from your list afterward.

Taking a look at test/globals.lua may help you, even if you seems to ask for
an API level solution. It shows how to precompile Lua code (using luac) and
how to extract information from the result.
Note: I just saw Lua 5.0-alpha's test/luac.lua which shows how to do the
luac work in Lua. Probably doesn't work in Lua 4.0

I hope this answer can help you.

Regards.

-- 
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--

GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net