[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [PATCH] bastardized lua #1
- From: Karel Tuma <ktuma@...>
- Date: Mon, 25 Sep 2006 12:06:20 +0200
Hello list,
This patch is part of somewhat larger project which called
for features contained in here. Sorry I don't have each part as a
separate
patch, but I maintain it as it is. Still, some people might find it
useful.
All of this is highly experimental and most likely breaks lots of
things!
Tested only on MacOSX/PowerPC.
This patch also aims to be syntax backward compatible with stock lua,
so if you encounter any discrepancy regarding that, tell me so.
Apply against 5.1.1
-ktuma/tumaka@freenode
Backwards compatible: yes
Bytecode compatible: no (new binop opcodes)
Credits: Rici Lake, Asko Kauppi, Christopher Dunn, Eric Tetz et al.
Bastardization contains:
- non-equality operator != along with ~=
- and, or, xor, shl, shr bit operators: &, |, ~, <<, >>
and appropiate metamethods: __and, __or, __xor, __shl, __shr
BUGS: probably broken on negative values
- __strhook for userdata-to-lua string masquerading (see
README.strhook)
BUGS: better dont use it at all :)
- __usedindex! it's like __newindex, but only if key is
already there...
- "then" is optional after if, "do" is optional after
"while" and "for"
- Rici's pseudo values in assignments, ie:
a, b, c = $+1, $+1, $1+$2 is expanded to: a, b, c = a+1, b
+1, a+b
This is very useful if you've long expression to modify as
lvalue:
tab[key].increment[y],tab[key].decrement[y] = $+1, $-1
Merged Asko Kauppi's power patches:
- do patch: Makes "= do ... end" be syntactic sugar for:
"= function() ... end" (handy with simple callbacks).
- continue patch
- literals patch (hex, utf8)
- integer optimization (non-FPU) - most of the bloat in the
patch ;-)
Attachment:
blua1.patch.gz
Description: GNU Zip compressed data