2

Would there be any performance boost from using one of the function. Is there a internal difference from using these two function, if so what are they.

1 Answers1

2

dofile, loadfile and loadstring all call the same primitive to parse scripts.

I assume you mean loadstring(file:read("*a")). In this case, there may be a small performance hit (which I haven't measured) because Lua has to store the whole contents of the file as a string. The primitive that parses scripts does not do that: it reads the input in pieces.

lhf
  • 70,581
  • 9
  • 108
  • 149