LuaRules.wiki
changeset 2192 edf132b3d2b8
parent 2191 aade57b7b63e
child 2195 f9dc7606394c
equal deleted inserted replaced
2191:aade57b7b63e 2192:edf132b3d2b8
     4 
     4 
     5 For scripts, there are some basic but important development rules that all scripts need to follow to ensure the scripts are compatible across multiple systems.
     5 For scripts, there are some basic but important development rules that all scripts need to follow to ensure the scripts are compatible across multiple systems.
     6 
     6 
     7 For behavior in your script that affects actual gameplay, there are restrictions of what you can do with numbers. These are the rules:
     7 For behavior in your script that affects actual gameplay, there are restrictions of what you can do with numbers. These are the rules:
     8 
     8 
     9 * Only integer numbers are allowed; floating-point numbers are forbidden
     9  * Only integer numbers are allowed; floating-point numbers are forbidden
    10 * If you divide, divide by powers of 2 if you can
    10  * If you divide, divide by powers of 2 if you can
    11 * If you want to divide by a different integer value, use the `div` function for integer division
    11  * If you want to divide by a different integer value, use the `div` function for integer division
    12 * Keep your numbers within (+/-) 2<sup>53</sup>
    12  * Keep your numbers within (+/-) 2<sup>53</sup>
    13 * Avoid `math.floor` and `math.ceil`
    13  * Avoid `math.floor` and `math.ceil`
    14 
    14 
    15 These restrictions on numbers don't apply to numbers that you don't use for gameplay but for stuff like harmless eye candy.
    15 These restrictions on numbers don't apply to numbers that you don't use for gameplay but for stuff like harmless eye candy.
    16 
    16 
    17 Failing to follow these rules might lead your script to behave differently on different systems, leading to desynchronization bugs, which means they will not work online.
    17 Failing to follow these rules might lead your script to behave differently on different systems, leading to desynchronization bugs, which means they will not work online.