lua-users home
lua-l archive

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


Hi. I've been looking at lua*_ prefixes in the Lua source code.

The Lua C API uses prefixes lua_ and luaL_. Searching the code, almost every alphabet letter from luaA_ to luaZ_ is used.

For lowercase, I see single letters luac_ and luai_ (for the compiler and interpreter programs), and luaall_ and lualib_; no others of up to three characters.

I don't see any uses of two or three letters like luaAA_ or luaAAA_, or even mixed case like luaAaa_.

I suppose it's possible not all of these names are exported, but most seem to be.

Anyways, what I've been wanting to do is make my own functions which work like Lua functions. For example, Lua has lua_isstring, lua_pushstring, lua_tostring, luaL_optstring, and luaL_checkstring. For my own type 'foo' (generally a full userdata), I'd like to provide lua_isfoo, lua_ispushfoo, lua_tofoo, lua_optfoo, and lua_checkfoo.

This makes my native code cleaner, but is also useful because in some cases those functions do extra work besides just working with a raw userdata pointer (e.g. extra indirection and lookups).

I like having my functions look like Lua functions because they work like Lua functions. So I'd like my functions to have a name prefix like luaFoo_ or similar.

My question is whether there is a documented list of Lua prefixes reserved for use by Lua. It seems like using more than one uppercase letter is safe, I'm just curious.


Marc