loadfile
loadfile
compiles the Lua source code from a file and returns the resulting function (chunk). This chunk runs in the global environment.
If the file contains syntax errors, an error is thrown - just like loadstring
. The error will appear in the console.
Parameters
Parameter | Description |
---|---|
path |
The path to the file to be loaded. |
Examples
Example 1
Loading and executing a valid file | |
---|---|