C_Timer and Interrupts?

If I set a function to be executed when my C_Timer interval expires, is that function deferred or is it executed right away?

Thanks,

Execution of the current code path doesn’t stop at the C_Timer. The function specified in the C_Timer is deferred until the time specified.

Do something
C_Timer.After(1, function x() end)
Do Something else

executes as

Do Something
Do something else
--- 1 second later
x

I understand that, but I may not have been clear. In your example, when the 1 second interval expires, does the o/s switch context from the currently running code to function(x)?

Thanks for your patience,

Lua is single threaded so yes. x() will execute until it ends or errors before executing whatever is next.

Unless it is simple, your addon code will be relying on events and/or OnUpdates.

In effect, C_Timer will “insert” x() in the next availably pause between events/updates and execute it, at which time your addon goes back to waiting.