# HG changeset patch # User Wuzzy # Date 1602461276 -7200 # Node ID b2f75d4bf715b3113c50a95a0d55a1cde8fa073d # Parent a6f98b1311f6f9bd15d44820d45631b75bec451b Add LuaRules.wiki diff -r a6f98b1311f6 -r b2f75d4bf715 LuaRules.wiki --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LuaRules.wiki Mon Oct 12 02:07:56 2020 +0200 @@ -0,0 +1,15 @@ +## Scripting Rules + +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. + +For behavior in your script that affects actual gameplay, there are restrictions of what you can do with numbers. These are the rules: + +* Only integer numbers are allowed; floating-point numbers are forbidden +* If you divide, divide by powers of 2 if you can +* If you want to divide by a different integer value, use the `div` function for integer division +* Keep your numbers within (+/-) 253 +* Avoid `math.floor` and `math.ceil` + +These restrictions on numbers don't apply to numbers that you don't use for gameplay but for stuff like harmless eye candy. + +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.