lua-users home
lua-l archive

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

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 internally.

You could use debug.getlocal to iterate over all locals, look for a matching name, and call its value, but that would be rather awkward. Though you could wrap it in an (inefficient) function.

On May 3, 2013 8:14 AM, "Laurent Faillie" <> wrote:

How to call a local function by it's name ?

Something like

local function normMilli( v ) return v/1000 end

local name = 'normMilli'
Then I need the call the function for which the name is stored in name

I know for global function, I can use _G, but I didn't find for local ones ?