Difference between revisions of "love.filesystem.load"
m (1 revision: Importing from potato (again).) |
(Added example) |
||
Line 1: | Line 1: | ||
− | |||
Load a file (but not run it) | Load a file (but not run it) | ||
== Function == | == Function == | ||
Line 10: | Line 9: | ||
=== Returns === | === Returns === | ||
{{param|function|chunk|The loaded chunk}} | {{param|function|chunk|The loaded chunk}} | ||
+ | == Examples == | ||
+ | === Execute everything in the folder "levels" === | ||
+ | <source lang="lua"> | ||
+ | for i, file in love.filesystem.enumerate("levels") do | ||
+ | love.filesystem.load("levels/" .. file)() -- last pair of parentheses runs it | ||
+ | end</source> | ||
== See Also == | == See Also == | ||
* [[parent::love.filesystem]] | * [[parent::love.filesystem]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
{{#set:Description=Load a file (but not run it)}} | {{#set:Description=Load a file (but not run it)}} |
Revision as of 15:47, 14 November 2010
Load a file (but not run it)
Contents
Function
Synopsis
chunk = love.filesystem.load( name )
Arguments
string name
- The name (and path) of the file
Returns
function chunk
- The loaded chunk
Examples
Execute everything in the folder "levels"
for i, file in love.filesystem.enumerate("levels") do
love.filesystem.load("levels/" .. file)() -- last pair of parentheses runs it
end