HatHelper
|
  |
 |
| Joined: 02 Mar 2009 |
| Total Posts: 46305 |
|
|
| 11 Feb 2013 03:38 PM |
Can anyone convert this into Lua? I have no idea what '?' ':' are, and how '!='(which I'm assuming is 'not') works
x=5 a = random(AA * ( ( x % 11 != 10 ) ? 2 : 1 ), BB * ( ( x % 11 != 10 ) ? 2 : 1 )) |
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 11 Feb 2013 03:49 PM |
| I think != is either greater than or less than. |
|
|
| Report Abuse |
|
|
|
| 11 Feb 2013 03:50 PM |
? and : are ternary operations.
x=5 a = random(AA * ( ( x % 11 != 10 ) ? 2 : 1 ), BB * ( ( x % 11 != 10 ) ? 2 : 1 ))
Lua:
x=5 a = math.random(AA * ( ( x % 11 ~= 10) and 2 or 1), BB * ( ( x % 11 ~= 10) and 2 or 1)) |
|
|
| Report Abuse |
|
|
HatHelper
|
  |
 |
| Joined: 02 Mar 2009 |
| Total Posts: 46305 |
|
|
| 12 Feb 2013 02:56 PM |
Thanks crazy, appreciate it.
|
|
|
| Report Abuse |
|
|