Your first script
Run a small Luau script and handle a compiled result.
Run something small
Start with a call whose result you can see immediately:
local name, version = identifyexecutor()
print(name, version)identifyexecutor returns two values. Luau lets you collect both in one assignment, as above, or ignore the second if you do not need it. You will see this pattern throughout the reference: the signature shows the returned values in their actual order.
Compile and run source
Acedia also provides loadstring for compiling source at runtime. Compilation and execution are separate steps:
local run, reason = loadstring("return 6 * 7", "=first-script")
if not run then
warn(reason)
return
end
print(run())If the source has a syntax error, loadstring returns nil and a reason. If compilation succeeds, it returns a function; the final line calls it. The optional second argument names the chunk in diagnostics.
Next, read about shared state and return and error conventions. The reference has the full signatures when you are ready to use another API.
