|
On 16/06/2011 20:21, Kev Lugli 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".
I don't know your purpose (or your level at Lua or programming in general), but I saw many times this question asked by beginners (in Java!) where they really wanted arrays or, at best, associative arrays. Both are simple tables in Lua.
local base = {} base['final'] = 'result' print(base.final) Sorry if I am off-base. -- Philippe Lhoste -- (near) Paris -- France -- http://Phi.Lho.free.fr -- -- -- -- -- -- -- -- -- -- -- -- -- --