lua-users home
lua-l archive

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



On 12 feb 2009, at 21:18, Peter Cawley wrote:

(1) extension of the luaL-check.. and luaL_opt.. repertoire with functions
for the retrieval of booleans.
The behaviour of such a function is very dependant upon the user's
requirements. Usually none,nil and nil always count as false, and
everything else is true, and hence lua_toboolean() does the job
without the need for an opt or check function. Having none or nil have
some other behaviour would be extremely counter-intuitive in most
cases.

You are right of course on the interpretation of what is false and what is true. But I think the essention of a luaL_optboolean is that in the case of an absent argument the optional value (given on the call to luaL_optboolean) is returned. That would make luaL_optboolean different from lua_toboolean without violating the general definition of what is false and what is true.


(2) at least one extra table slot on userdata.
That would be the userdata's environment table -
http://www.lua.org/manual/5.1/manual.html#lua_setfenv


Did I really miss this easy solution? I am afraid it looks that way! First thing in the morning will be to investigate its application to the module under development. Thanks!

Hans van der Meer