mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
fix coroutine example: use thread state
This commit is contained in:
parent
077301092f
commit
e7559e91d8
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user