lua-users home
lua-l archive

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

On Fri, 9 Nov 2007, David Manura wrote:

Evan DeMond wrote:
but should the names of CLUE_IMPORT and CLUE_EXPORT be switched?

I like SET/GET, which is consistent with the naming conventions of the Lua C API. IMPORT/EXPORT reminds me of modules in other languages (but note that "export" is used in the Reference Manual in two different ways.)

I've used GET/SET for the shortly-to-be-released release 3, in the same sense as the Lua API.

#define CLUE_DO(L, code)                        \
  luaL_dostring(L, code)

Careful: luaL_dostring expands to a lua_pcall(L, 0, LUA_MULTRET, 0)). The LUA_MULTRET can leave values on the stack. I think you want lua_pcall(L, 0, 0, 0)).


On the other hand, it could be useful for CLUE_DO to be able to return values, which for one thing would allow a single function to support all of CRUD.

That would be cute, but GET/SET are both more convenient (no string formatting needed) and avoid problems with representation (no string formatting needed).

-- | The yak is slow but the earth is patient (LucasArts)