Takes a string of Luau source code, compiles it, and returns the compiled chunk as a function. Compiling doesn’t run the code - call the returned function to do that.
Most commonly used to run a script hub fetched over HTTP in one line: loadstring(game:HttpGet(url))().
Parameters
Returns
(function, nil) on success, (nil, string) on failure.
Example
Fetch a script hub over HTTP and run it through loadstring(), guarding the compile so a syntax error in the fetched source warns you instead of failing silently:
Does not execute bytecode; pass plain text Luau code.