lua-users home
lua-l archive

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


On Thu, Jun 16, 2011 at 7:21 PM, Kev Lugli <kevlugli@gmail.com> wrote:
> Hi, maybe it's a silly question, but I'd like to know how to declare
> for example a function using a variable in its name. For example:
>
> base = 'f'
> base..'inal' = 'result'
> ^
> ^
> Where "base" is a variable and "inal" a simple string.
> The resulting variable name sould be "final".
> Thanks in advance.
>
>

 base = 'f'
 _G[base..'inal'] = 'result'

-Duncan