Commit 5791b3ee authored by Jack's avatar Jack
Browse files

fixed issue with one line if which was consuming else on new line which should...

fixed issue with one line if which was consuming else on new line which should have been of normal enclosing if, working on adding support fort coroutines
parent dbdc9920
......@@ -51,4 +51,20 @@ function del(t, v)
t[i] = t[i+1]
end
end
end
function cocreate(f)
return coroutine.create(f)
end
function yield()
coroutine.yield()
end
function coresume(f, ...)
coroutine.resume(f, table.unpack(arg))
end
function costatus()
return coroutine.status(f)
end
\ No newline at end of file
......@@ -1451,8 +1451,6 @@ static void inline_if(LexState* ls, expdesc* v)
ls->ignorenewline = 0;
statlist(ls); /* parse true block */
ls->ignorenewline = 1;
while (testnext(ls, TK_EOL));
leaveblock(fs);
......@@ -1460,11 +1458,11 @@ static void inline_if(LexState* ls, expdesc* v)
if (testnext(ls, TK_ELSE))
{
ls->ignorenewline = 0;
block(ls); /* 'else' part */
ls->ignorenewline = 1;
while (testnext(ls, TK_EOL));
}
ls->ignorenewline = 1;
while (testnext(ls, TK_EOL));
}
static int test_then_block (LexState *ls, int *escapelist) {
......
......@@ -943,6 +943,10 @@ void Code::loadAPI()
L = luaL_newstate();
}
luaopen_base(L);
luaopen_table(L);
luaopen_coroutine(L);
std::ifstream apiFile("api.lua");
std::string api((std::istreambuf_iterator<char>(apiFile)), std::istreambuf_iterator<char>());
......@@ -973,9 +977,6 @@ void Code::initFromSource(const std::string& code)
if (!L)
L = luaL_newstate();
luaopen_base(L);
luaopen_table(L);
registerFunctions(L);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment