lars.oj.lindner Posted Tuesday at 09:54 PM Posted Tuesday at 09:54 PM I have a lua function that I want to call each 10 seconds but I don’t now how to in simrail. the closet thing I hav come across is the PerformUpdate function but that does not fel right since it is called each frame. is there another way to accomplice this?
lewnemejski Posted Tuesday at 10:38 PM Posted Tuesday at 10:38 PM (edited) CreateCoroutine(function () while true do MyFunction() coroutine.yield(CoroutineYields.WaitForSeconds, 10) end end) Maybe something like this? Edited Tuesday at 10:39 PM by lewnemejski 1
lars.oj.lindner Posted Wednesday at 09:16 PM Author Posted Wednesday at 09:16 PM I have tried that before with no success but when placing the function in EarlyScenarioStart it worked. Thankyou.
lewnemejski Posted Wednesday at 10:19 PM Posted Wednesday at 10:19 PM 1 hour ago, lars.oj.lindner said: I have tried that before with no success but when placing the function in EarlyScenarioStart it worked. Thankyou. Because CreateCoroutine need to be inside of a function. Cannot be placed outside.
Recommended Posts