static int TimeoutAsync(IntPtr state) { IntPtr co = LuaStack.GetThread(state, 1); float time = (float)LuaStack.GetNumber(state, 2); Observable.Timer(TimeSpan.FromSeconds(time)).Subscribe(x => { LuaThread.ResumeSubthread(co, state, 0, out _); }); return(0); }