Spawn(print) How does it work?

How does:

spawn(print) 

Output any code? There are no parameters for print so how does it work?

Example output:

spawn expects you to pass in a function, that function you pass in is then called and given 2 things, the time that passed between calling spawn to when the function was invoked and how long the engine has been running

so then what prints out???

And

So. These both get passed as parameters to the print function as @EmbatTheHybrid said. And we know print outputs the parameters value.

1 Like

The function passed into spawn gets 2 arguments, time based from when spawn was called and when the function passed to spawn was called and the current elapsedTime()

1 Like

Oh never mind im dumb I didnt realize they were to seperate things printed :man_facepalming:

so spawn(print) has 2 hidden arguments,

spawn(print(time it was invoked, how long the engine has been running for))

Correct, because those are the 2 parameters spawn automatically passes to the function it calls

1 Like