vci.StartCoroutine( coroutine.create( function() print("コルーチン開始") local i = 0 while i < 10 do -- カウントする print(i) i = i + 1 -- 0.5秒スリープする sleep(0.5) end print("コルーチン終了") end ) ) function sleep(sec) local t0 = os.time() + sec while os.time() < t0 do -- コルーチンの実行を中断する coroutine.yield() end end