lua-users home
lua-l archive

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


> * following a suggestion in the list, lua_type will return a code for the
> type, instead of a string. More exactly, the new API will be
>
>     /*
>     ** types returned by `lua_type'
>     */
>     #define LUA_TNONE       (-1)
>
>     #define LUA_TUSERDATA   0
>     #define LUA_TNIL        1
>     #define LUA_TNUMBER     2
>     #define LUA_TSTRING     3
>     #define LUA_TTABLE      4
>     #define LUA_TFUNCTION   5
>
>     int            lua_type (lua_State *L, int index);
>     const char    *lua_typename (lua_State *L, int t);

Why does lua_typename take a state if the information is static?  You could
image situations where you want the type name strings without having a state
opened, such as initializing the GUI of a graphical Lua debugger.  A
"LUA_TMAX" might also be helpful, but starting the enum at -1 kind of gets
in the way.

-John