Ah, you’ve stumbled across one of a few discrepancies between the different platforms Defold supports. On HTML5 and iOS 64 bit platforms we use plain old Lua 5.1 and on all other platforms we use LuaJIT.
goto
is a part of Lua 5.2 and upwards but LuaJIT which is based on Lua 5.1 has a couple of added extensions, one being the support for goto
.
To ensure that your game will run on all platforms it is not recommended to use any language features other than the ones provided by Lua 5.1.
We have three separate tickets in our backlog to make the platforms using Lua 5.1 more in line with LuaJIT:
DEF-1742 - Add support for the bitop module in Lua 5.1
DEF-1439 - Add support for pcall and xpcall inside coroutines in Lua 5.1 (using the Coco extension)
DEF-1284 - Upgrade LuaJIT to a version which supports 64 bit ARM