CC: Tweaked

CC: Tweaked

59M Downloads

"goto" recognized as name instead of symbol

Zirunis opened this issue ยท 4 comments

commented

Minecraft Version

1.16.x

Version

1.101.3

Details

My program fails during compilation on a line containing a 'goto' with the error "Unexpected symbol after name."

"Did you mean to assign this or call it as a function?"

This is the part of the code that fails:

for _, neighbor in ipairs(current:getNeighbors(goal)) do
    for _, node in pairs(closed) do
        if neighbor == node then
            goto continue --this is the line that fails. In the error the c is underlined.
        end
    end
   --removed more irrelevant code here for simplicity
    table.insert(open, neighbor)
    ::continue::
end

Maybe goto is simply not implemented on the version I'm using? I only found the compatibility table on tweaked.cc which states that goto is supported. I could implement it without goto but found the code cleaner this way and was surprised when it didn't work.

commented

Lua 5.2 support was added in version 1.109.0, you will need to update to a newer version of the mod in order to use goto.

commented

Thank you for the fast reply! How could I have found that out myself? Searching through the changelogs?

commented

Normally we try to include the version something was introduced/changed in the docs. Unfortunately, changes to the underlying Lua VM aren't normally included - for that you do normally need to check the changelog I'm afraid.

commented

Noted. Thank you for all your work! It is very much appreciated!