lua-users home
lua-l archive

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


> All globals, including functions, are (usually) stored in a special
> table called _G. So all you need to do is:
> 
> function callfunction(n, ...)
>  local name = AtcActions(n)
>  local f = _G[name]
>  return f(...)
> end
> 
> e.g.:
> print(callfunction("2", "word"))

It's also perfectly functional to write

_G[AtcActions(n)](...)

(although not always easy to read).