-
Notifications
You must be signed in to change notification settings - Fork 27
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
SyntaxError: Illegal break statement #16
Comments
This is a hard work now, cause currently I use function to make variables in correct block. You can try #4 at luajs.org, compile can give result, but break will be in a function: do
{
l.__call(l._f(function()
{
var a$2 = 1;
b$1 = l.__add(b$1,1);
if ((l.__eq(b$1,3)))
{
break;
}
}),[]);
}while (!(l.__eq(l.__get(_ENV,"a"),1))); This is why thing happens. I think it would be a simple way to target to ES2015(use Or we can just learn the way babel do with I wrote lua.js in old days(2 years ago). I learned much in these 2 years. I think maybe I should rewrite it in modern ways(commonJS, webpack, ES6, etc...), but I didn't have time in these days. |
The other reason to rewrite lua.js is we can use Proxy to optimize the way that metatable works. This could make lua.js run 25%-100% faster. |
Thank you for you replay. But I think this is a important issue that must be resolved, or lua.js become useless, because break is in common use. I have an idea to easily solve this issue, you could try this: do
{
var isbreak = false;
isbreak = l.__call(l._f(function()
{
var a$2 = 1;
b$1 = l.__add(b$1,1);
if ((l.__eq(b$1,3)))
{
return true;//break
}
}),[]);
if (isbreak) break;
}while (!(l.__eq(l.__get(_ENV,"a"),1))); Just translate |
This should be fixed in recent commits. I'll update web version later. |
I try my code here:https://raw.githubusercontent.com/Jennal/LuaUtils/master/src/Oop.lua
Click Compile & Run, get the SyntaxError: Illegal break statement
Can you fix this?
The text was updated successfully, but these errors were encountered: