[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Call a local function by name.
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 3 May 2013 12:59:18 -0300
> Someone correct nee if I'm wrong, but you can't, unfortunately. Local
> functions and variables are special in Lua. They're stored as numerical IDs
My only correction is that I would use the adjective "special" the other
way around. Usually, variable names (as other identifiers in programming
languages) serve only to connect uses of something with its definition,
so it is quite usual for a compiler or precompiler to convert them to
numbers, addresses, etc. In particular, renaming a variable to another
name (of course avoiding collisions) should never change the meaning of a
What is special is global variables (in the case of Lua), which allows a
form of introspection.