It looks like you're new here. If you want to get involved, click one of these buttons!

- 7.8K All Categories
- 11 Help with translations
- 4.2K General questions
- 106 Roadmap
- 358 Game & application design
- 315 Plugins
- 70 User experience
- 75 Marketplace
- 290 Code snippets
- 34 Building a team?
- 269 Suggestions & requests
- 352 Announce your apps made with Gideros.
- 90 Step by step tutorials
- 667 Bugs and issues
- 195 Introduce yourself
- 238 Announcements
- 106 Forum talk
- 403 Relax cafe

SinisterSoft
Maintainer

The Gideros version of Lua has some extra operators not present in regular Lua.

Two of them are <> and >< (remember these are custom to Gideros Lua)

<> is used to compare two numbers and return the greater of them

>< is used to compare two numbers and return the lesser of them

You may not think so initially, but these are two really handy operators and can save your game both a lot of code and cpu time.

eg:

Instead of this:

You can put this:

Both of these routines will produce:

To limit a number going up just use the other operator:

This will produce:

Two of them are <> and >< (remember these are custom to Gideros Lua)

<> is used to compare two numbers and return the greater of them

>< is used to compare two numbers and return the lesser of them

You may not think so initially, but these are two really handy operators and can save your game both a lot of code and cpu time.

eg:

Instead of this:

pos=10 function gameLoop(e) x=x-1 if x<5 then x=5 end print(x) . . |

pos=10 function gameLoop(e) x=(x-1)<>5 print(x) . . |

9 8 7 6 5 5 5 and so on... |

pos=10 function gameLoop(e) x=(x+1)><15 print(x) . . |

11 12 13 14 15 15 15 and so on... |

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

https://deluxepixel.com

## Comments

Likes: SinisterSoft, pie

https://deluxepixel.com

https://deluxepixel.com

Likes: SinisterSoft

https://deluxepixel.com

a <> b

to find the lesser

a >< b

to convert from degrees to radian

^< a

to convert from radians to degrees

^> a

bitwise operators

a|b bor

a&b and

~a not

a~b xor

a<<b shift a left by b bits

a>>b shift a right by b bits

a//b integer divide use instead of floor(a/b)

macros

pi@3.142 set pi to 3.142 - isn't a variable so it acts like a constant

also the saving/loading of lua byte code is universal between different processor word sizes - eg 32 and 64 bit - unlike regular Lua.

https://deluxepixel.com

Likes: SinisterSoft

Likes: antix, Atavismus

https://deluxepixel.com