lua-users home
lua-l archive

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


All types in Lua, being first class values, are purely values - the name
only comes from the variable(s) the value is stored in.  As such, functions
(being values) do not have a name.  They may be stored in one or more
variables, each with a name, but still the function itself has no inherent
name.

If you know that it is a global function, or know what table / namespace it
is in, you can iteratively search for a table entry with the same function
value, then print the name of this key.  Of course there may be more than
one, so you could print them all, or the first one or whatever

Love, Light and Peace,
- Peter Loveday
Director of Development, eyeon Software


----- Original Message -----
From: "xenarcher" <nickl@volition-inc.com>
To: "Multiple recipients of list" <lua-l@tecgraf.puc-rio.br>
Sent: Monday, November 25, 2002 4:58 PM
Subject: converting lua functions to strings


> Is there a way to convert a Lua function to a string, either in Lua
> or C code? I'd like to extract the name of a Lua function from the
> first-class function value.
>
>