Nested print statements run faster in the nest than outside or the "Host" of the nest/thread

I was just faffing around and decided to open the end parenthesis of the print statement of the “Hello World” line and found out you could nest prints within each other. Here is what I found out.

Examples:

image

image

Give me your best response on how this could be useful in any way. :wink:

1 Like

I don’t think they actually run “faster”, what you’re seeing is sort of equivalent to how order of operations works in math. The inner portion (second argument) runs first before the first print statement can run. At the end of the day it’s still two print statements.

4 Likes

This is due to the fact that function calls as arguments will always be compiled first. So their instructions come first in the lua VM.
The equivalent of that script would actually be:

(arg1) = print(“Hello 2”)
print(“Hello, world!”, (arg1));

2 Likes

thanks for the feedback. turns out the timer thingy in the output is useful (in some regards).
it’s just telling me that it’s literally a .001 second difference.