lua-users home
lua-l archive

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

Luiz Henrique de Figueiredo wrote:
> >It would be nice if there were set/getlocal tag methods,
> There are [sic] such tag methods because of performance.

That is unfortunate that their introduction would introduce such a hit.

What I really appreciate about this language is the sheer amount of
stuff that you can get done "behind the scenes" using tag methods;
while maintaining simple syntax!  It's too bad that this means one
cannot use such simple syntax in this case.  

[At this point I'm not too worried about speed, but am focused more
on codesize and simplicity of syntax for non-programmers.]

> >if locals could be accessed via an implicit local table (can they?).
> Yes, via the debug API (or debug library in Lua).
> See lua_getlocal/lua_setlocal and getlocal/setlocal.
> But heed this warning in the manual:
>  You should exert great care when using this library. The functions
>  provided here should be used exclusively for debugging and similar
>  tasks (e.g., profiling). Please resist the temptation to use them as a
>  usual programming tool. They are slow and violate some (otherwise)
>  secure aspects of the language (e.g., privacy of local variables).

I guess that is why I missed those routines.  I have avoided the
debug library because of that very same warning in the documentation!