fix coroutine example: use thread state

This commit is contained in:
voidProc 2020-03-23 09:29:23 +09:00 committed by The Phantom Derpstorm
parent 077301092f
commit e7559e91d8

View File

@ -24,7 +24,7 @@ end
lua.script(co_lua_script); lua.script(co_lua_script);
sol::thread runner = sol::thread::create(lua.lua_state()); sol::thread runner = sol::thread::create(lua.lua_state());
sol::state_view runnerstate = runner.state(); sol::state_view runnerstate = runner.state();
sol::coroutine loop_coroutine = lua["loop"]; sol::coroutine loop_coroutine = runnerstate["loop"];
lua["counter"] = 20; lua["counter"] = 20;
for (int counter = 0; counter < 10 && loop_coroutine; ++counter) { for (int counter = 0; counter < 10 && loop_coroutine; ++counter) {