Davidobot / love.js

LÖVE ported to the web using Emscripten, updated to the latest Emscripten and LÖVE (v11.5)
MIT License
605 stars 27 forks source link

Syntax errors that only occur on love.js #62

Open teknixstuff opened 2 years ago

teknixstuff commented 2 years ago

image

The affected code is:

...
                elseif side == 1 then
                    if id == 16 then lastcell.rot = (lastcell.rot + 1)%4 end
                    dir = (dir + 1)%4
HERE:           else goto stop end
            elseif id == 31 or id == 92 then
                if side == 0 or side == 2 then
                    if id == 31 then lastcell.rot = (lastcell.rot - 1)%4 end
                    dir = (dir - 1)%4
...

On the normal windows 64-bit love.exe from https://love2d.org the game loads up and looks like this: image The full love file can be found here I am using compatibility mode with love.js if that makes any difference

teknixstuff commented 2 years ago

I have fixed the issue in my particular game by replacing all the usages of goto with an alternative.

teknixstuff commented 2 years ago

I don't think the issue should be closed however, as goto is an important part of lua syntax and should work.

alexjgriffith commented 5 months ago

Goto was only introduced in Lua 5.2. Luajit adopted the feature. Since there is no wasm support for luajit, the web target relies on Lua 5.1. There is no fix, short of getting luajit to target wasm. When using the web port make sure to stick to Lua 5.1 syntax.