Some changes to make login.init more consistent.

This commit is contained in:
2026-06-09 17:36:58 -04:00
parent 7d6898edb3
commit 0b5c47d8c7
5 changed files with 38 additions and 35 deletions

View File

@@ -607,20 +607,13 @@ LuaDefine(tangible_start, "tangible,function,arg1,arg2...",
"|to continue running until it blocks. But from that point"
"|forward, the thread will never be resumed for any reason.") {
int top = lua_gettop(L);
if (top < 2) {
luaL_error(L, "Not enough arguments to tangible.start");
return 0;
}
int varlen = top - 2;
World *w = World::fetch_global_pointer(L);
w->guard_blockable(L, "tangible.start");
LuaArg place, fname;
LuaExtraArgs extra;
LuaVar mt, classtab, plthreads, thread, thinfo, func, tanlist;
LuaDefStack LS(L, mt, classtab, plthreads, thread, thinfo, func, tanlist);
LuaSpecial place(1);
LuaSpecial fname(2);
LuaDefStack LS(L, place, fname, extra, mt, classtab, plthreads, thread, thinfo, func, tanlist);
// If they passed in a single tangible, convert it to a tangible list.
int64_t place_id = LS.tanid(place);
@@ -677,10 +670,10 @@ LuaDefine(tangible_start, "tangible,function,arg1,arg2...",
// Create a new thread, set up function and arguments.
lua_State *CO = LS.newthread(thread);
lua_pushvalue(L, func.index());
for (int i = 0; i < varlen; i++) {
lua_pushvalue(L, i + 3);
for (int i = 0; i < extra.size(); i++) {
lua_pushvalue(L, extra.index(i));
}
lua_xmove(L, CO, varlen + 1);
lua_xmove(L, CO, extra.size() + 1);
// Create the thread info table.
LS.newtable(thinfo);