Difference between revisions of "Loadfile"

From GiderosMobile
m (Text replacement - "<source" to "<syntaxhighlight")
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Loads a chunk from the file without execution.
 
Loads a chunk from the file without execution.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
(function) = loadfile(filename)
 
(function) = loadfile(filename)
 
</source>
 
</source>

Revision as of 15:28, 13 July 2023

Available since: Gideros 2011.6
Class: (global)

Description

Loads a chunk from the file without execution. <syntaxhighlight lang="lua"> (function) = loadfile(filename) </source>

If there are no errors, returns the compiled chunk as a function, otherwise returns nil plus the error message. The environment of the returned function is the global environment.

Parameters

filename: (string) name of the file to load

Return values

Returns (function) compiled chunk as a function, otherwise returns nil