Temporarily enable coroutine library
This commit is contained in:
@@ -77,6 +77,7 @@ static void source_install_builtins(lua_State *L) {
|
|||||||
load_builtin_class(L, "string", luaopen_string);
|
load_builtin_class(L, "string", luaopen_string);
|
||||||
load_builtin_class(L, "math", luaopen_math);
|
load_builtin_class(L, "math", luaopen_math);
|
||||||
load_builtin_class(L, "debug", luaopen_debug);
|
load_builtin_class(L, "debug", luaopen_debug);
|
||||||
|
load_builtin_class(L, "coroutine", luaopen_coroutine);
|
||||||
|
|
||||||
// Nuke a few of the builtin functions for sandboxing reasons.
|
// Nuke a few of the builtin functions for sandboxing reasons.
|
||||||
LS.getglobaltable(globtab);
|
LS.getglobaltable(globtab);
|
||||||
@@ -352,3 +353,21 @@ void SourceDB::init(lua_State *L) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These should go away eventually. They're for debugging.
|
||||||
|
LuaDefine(coroutine_setnextid, "c") {
|
||||||
|
LuaArg co, lid;
|
||||||
|
LuaStack LS(L, co, lid);
|
||||||
|
lua_State *CO = LS.ckthread(co);
|
||||||
|
lua_Number id = LS.ckinteger(lid);
|
||||||
|
lua_setnextid(CO, id);
|
||||||
|
return LS.result();
|
||||||
|
}
|
||||||
|
|
||||||
|
LuaDefine(coroutine_getnextid, "c") {
|
||||||
|
LuaArg co;
|
||||||
|
LuaRet lid;
|
||||||
|
LuaStack LS(L, co, lid);
|
||||||
|
lua_State *CO = LS.ckthread(co);
|
||||||
|
LS.set(lid, lua_getnextid(CO));
|
||||||
|
return LS.result();
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user