A few assorted cleanups.
This commit is contained in:
@@ -403,10 +403,14 @@ void World::invoke_plan(int64_t actor_id, int64_t place_id, const std::string &a
|
||||
|
||||
// Create a new thread, set up function and parameters.
|
||||
lua_State *CO = LS.newthread(thread);
|
||||
|
||||
// Push the function to be invoked and its arguments.
|
||||
lua_pushvalue(L, func.index());
|
||||
lua_pushvalue(L, actor.index());
|
||||
lua_pushvalue(L, place.index());
|
||||
lua_pushvalue(L, invdata.index());
|
||||
|
||||
// Move actor, place, function and args to new thread.
|
||||
lua_xmove(L, CO, 4);
|
||||
|
||||
// Store the thread into place's thread table.
|
||||
@@ -454,7 +458,7 @@ void World::run_scheduled_threads(int64_t clk) {
|
||||
// Resume the coroutine.
|
||||
lua_State *CO = LS.ckthread(thread);
|
||||
int top = lua_gettop(CO);
|
||||
int status = lua_resume(CO, nullptr, (top > 0) ? (top - 1) : 0);
|
||||
int status = lua_resume(CO, nullptr, (top >= 4) ? 3 : 0);
|
||||
|
||||
// Three possible outcomes: finished, yielded, or errored.
|
||||
if (status == LUA_YIELD) {
|
||||
|
||||
Reference in New Issue
Block a user