[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Adding a __toboolean metamethod to Lua 5.0.
- From: "Fred Bertsch" <fred_bertsch@...>
- Date: Mon, 07 Feb 2005 14:22:46 -0800
Hello!
I'm currently using Lua in a project at work, and it's working really well. 
Thanks! Our users love it; even the users who have never programmed before 
love it. :)
I've found several discussions in the past about the possibility of adding a 
metamethod that would convert a value to a boolean. Essentially, I would 
like conditional expressions such as those in if statements or while loops 
to check for a __toboolean metamethod before assuming that a non-nil value 
is true.
Has anyone actually made such a change? It's not listed as an available 
"power patch" in the Wiki, but it seems to have been discussed several times 
already on the list. If no such change exists, does anyone have any advice 
on where to go in the source code to make such a change? If there's any 
interest, I'd be happy to share such a change in the same format as the 
other patches listed on the Wiki once I get it working.
Thanks again,
Fred
http://www.styleadvisor.com/