lua-users home
lua-l archive

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

> Is there a way to write an expand function that make use of the local variables (not global)?
> function do_stuff (p1)
>    print(expand'$(p1+1)')
> end
> do_stuff(1)
> --> 2

You could use the debug library for that, though its use for ordinary
programming is not recommended. If you have control over do_stuff, then
you could created a table with the values of the locals before calling
expand and pass it to expand.