@N1cke added support for Macros some time ago, but there hasn't been much discussion about them. So I decided to share what I have to start a conversation about different things that can be used to speed up the maths side of things.
Here are some examples of macros to speed things up:
pi@3.14159265358979324
deg@|(180.0/pi)*|
rad@|(pi/180.0)*|
by using something like d=deg(angle)
This gets converted before the text is parsed into:
d=(180.0*3.14159265358979324)*angle
The tokeniser evaluates the (180.0*3.14159265358979324) before it gets tokenised, so it becomes 565.486678*angle in tokens.
This is much faster than using the math lib deg function.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
https://deluxepixel.com
Comments
<> is used for max and >< is used for min...
Likes: vitalitymobile, antix, stetso
https://deluxepixel.com
Gideros uses radians for the math library (sin, cos, etc) and degrees for the gfx api (rotation, etc) so these two functions are usually used a lot.
Likes: stetso
https://deluxepixel.com
all in all they look funny but i hope there won't be much more of them...
Likes: Holonist
Fragmenter - animated loop machine and IKONOMIKON - the memory game
They will be a *lot* faster though than using the lib versions - there is a lot less overhead as they are dealt with directly by the interpreter rather than the interpreter searching for the lib entry and then using the lua-c interface.
Likes: antix, keszegh
https://deluxepixel.com
For places where you use a load of these kind of calculations it should speed things up considerably. I'm looking forward to them
Likes: SinisterSoft, simwhi, MobAmuse