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

- 6.5K All Categories
- 3.7K General questions
- 85 Roadmap
- 281 Game & application design
- 256 Plugins
- 52 User experience
- 65 Marketplace
- 221 Code snippets
- 33 Building a team?
- 228 Suggestions & requests
- 307 Announce your apps made with Gideros.
- 81 Step by step tutorials
- 504 Bugs and issues
- 158 Introduce yourself
- 150 Announcements
- 60 Forum talk
- 368 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:

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 |

You can put this:

pos=10 |

Both of these routines will produce:

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

8

7

6

5

5

5 and so on...

pos=10 |

This will produce:

11

12

13

14

15

15

15 and so on...

## Comments

Aye: SinisterSoft, pie

Can be turned into...

http://SinisterSoft.com

http://facebook.com/WhatRhymesWithMartians

And another to always return the positive of a number:

This should be faster than

or

But I haven't done any speed check to make sure.

http://SinisterSoft.com

http://facebook.com/WhatRhymesWithMartians

Aye: SinisterSoft

http://SinisterSoft.com

http://facebook.com/WhatRhymesWithMartians

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.

http://SinisterSoft.com

http://facebook.com/WhatRhymesWithMartians

Aye: SinisterSoft

Aye: antix, Atavismus

http://SinisterSoft.com

http://facebook.com/WhatRhymesWithMartians