When you 'invoke' lua code, it creates coroutine

This commit is contained in:
2021-11-30 12:39:09 -05:00
parent 742209988b
commit 5db5a8b06f
6 changed files with 81 additions and 48 deletions

View File

@@ -264,6 +264,13 @@ bool world_type_authoritative(util::WorldType wt) {
return (wt == WORLD_TYPE_MASTER) || (wt == WORLD_TYPE_STANDALONE);
}
LuaSourcePtr make_lua_source(const std::string &code) {
LuaSourcePtr result(new LuaSourceVec);
std::string fn = "file.lua";
result->push_back(std::make_pair(fn, code));
return result;
}
static std::string get_file_contents(const std::string &fn) {
std::ifstream fs(fn);
std::stringstream buffer;