Function roblox::function::spawn [−][src]
pub fn spawn<CB>(callback: CB) where
CB: FnMut(),
Expand description
Equivalent to void spawn(function callback)
in Luau.
Runs the specified callback function in a separate thread, without yielding the current thread. The function will be executed the next time Roblox’s Task Scheduler runs an update cycle. This delay will take at least 29 milliseconds but can arbitrarily take longer, depending on the target framerate and various throttling conditions. The callback function is invoked with two arguments:
The first being the amount of time which elapsed from when spawn was called
to when the function was invoked
The second being equivalent to elapsed_time()
or roughly how long the engine has been running