How to update a lua script from 3.0 to 3.1

This document describes how to convert freeciv-3.0 compatible lua script to one compatible with freeciv-3.1. Please check these carefully to avoid your script mis-behaving, maybe in some rarely reached special case. These are changes to scripting API requiring special attention. Additions to the API that do not affect old scripts are not listed.
==lua-5.4==
Lua engine has been updated from lua-5.3 to lua-5.4. Check lua documentation for the non-freeciv-specific changes in the scripting language itself.
==Calling move functions without side-effects deprecated==
edit.unit_teleport(unit, dest), Unit:teleport(dest), edit.unit_move(unit, moveto, movecost), and Unit:move(moveto, movecost) have been deprecated.
Use the forms that set also which side-effects the move is allowed to have.
==Unit loss message in lua==
Formerly hardcoded unit loss messages need to be implemented in lua now. The default/default.lua has such an implementation. Any ruleset with a custom default.lua need to implement it themselves.
== See also ==
Category:Event scripting