Skip to content

Invalid lua generated with for, continue, and return #215

Description

@kevinw

This moonscript:

things = {1, nil, 2}
for thing in *things
  if move == nil
    continue
  print(thing)
  return

Compiles to invalid lua:

local things = {
  1,
  nil,
  2
}
for _index_0 = 1, #things do
  local _continue_0 = false
  repeat
    local thing = things[_index_0]
    if move == nil then
      _continue_0 = true
      break
    end
    print(thing)
    return 
    _continue_0 = true
  until true
  if not _continue_0 then
    break
  end
end

The error:

lua: bug.lua:16: 'until' expected (to close 'repeat' at line 8) near '='

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions