lua-users home
lua-l archive

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


On 3 February 2011 00:36, Patrick Mc(avery
<spell_gooder_now@spellingbeewinnars.org> wrote:
> This code:
>
> for i = 10, 1 do
> local  value .. i = {}
> end
>
>
> does not work, I am assuming it's because variables do not have types only
> values do?
>
> Is there someway to automatically generate variable names?
>
> Thanks for reading-Patrick
>
>

You cannot generate names for locals (and why would you.... you can't
(without debug hackery) iterate over them...); you can for the current
environment though with getfenv(1)[value .. i] = { }
Unless you've changed your environment, getfenv(1) should be the
global table (also found as _G)

Daurnimator.