[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Zero as False
- From: Paige DePol <lual@...>
- Date: Tue, 19 Nov 2013 17:35:03 -0600
> On Nov 19, 2013, at 5:23 PM, Claire Lewis <claire_lewis@live.com.au> wrote:
>
> Also keep in mind this precludes doing and/or style ternary code with 0 as one of the values:
>
> x = bool_var and 0 or 1 -- won't work 'as expected' any more.
>
> This may be acceptable in your own dialect, but do keep in mind with any of these changes, it pretty much means no Lua modules are going to work (you'll have to reinvent them all), and you'll never get LuaJIT to work with these changes (unless you want to rewrite chunks of the JIT compiler...). These may or may not be important for future versions of your engine, of course.
>
> - Claire.
I am using ternary if's at the moment as the 'and/or' style ternary has it's own issues.
As this is my own dialect of Lua I fully expect to not remain compatible with extant libraries or LuaJIT. Once LuaJIT is upgraded to work with Lua 5.2.x then I will probably hack some of my language changes into it. However, for now, my hacks to Lua are mostly for educational purposes, with the side-effect of creating a fun language I can call my own and use in my 3D engine!
My last patch added full perl-style regular expressions to Lua using the =~ operator, including regexp callouts and indexing of the regexp variable after using =~ to obtain numbered or named backrefs.
So far I have 18 or so patches to Lua, some trivial, some fairly complex. Right now I am working on implementing a switch/case using a jump table for speedy execution! Playing with Lua in this way has been exhilarating and very educational! :)
~pmd~