Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kevinw opened this issue Sep 24, 2015 · 0 comments
Closed

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

kevinw opened this issue Sep 24, 2015 · 0 comments

Comments

@kevinw
Copy link

kevinw commented Sep 24, 2015

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 '='
@kevinw kevinw changed the title moonscript compiles invalid lua with for, continue, and return Invalid lua generated with for, continue, and return Sep 24, 2015
@leafo leafo closed this as completed in 87c88fe Sep 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant