Difference between revisions of "Lfs"
From GiderosMobile
(added example) |
|||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | |||
− | |||
<!-- GIDEROSOBJ:lfs --> | <!-- GIDEROSOBJ:lfs --> | ||
Line 8: | Line 6: | ||
'''<translate>Available since</translate>:''' Gideros 2012.8<br/> | '''<translate>Available since</translate>:''' Gideros 2012.8<br/> | ||
− | === | + | === Description === |
LFS or LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution. | LFS or LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution. | ||
Line 14: | Line 12: | ||
For more information and detailed documentation, please visit http://keplerproject.github.io/luafilesystem/manual.html#reference. | For more information and detailed documentation, please visit http://keplerproject.github.io/luafilesystem/manual.html#reference. | ||
+ | |||
+ | === Example === | ||
+ | <source lang="lua"> | ||
+ | local mypixel = Pixel.new(0xff0000, 1, 64, 64) | ||
+ | local myrt = RenderTarget.new(mypixel:getWidth(), mypixel:getHeight()) | ||
+ | myrt:draw(mypixel) | ||
+ | |||
+ | local lfs = require "lfs" | ||
+ | lfs.chdir("c:/temp") -- on windows ("c:\\temp") also works | ||
+ | local dir = lfs.currentdir().."\\" -- append \ | ||
+ | myrt:save(dir.."myfile.png") -- saved to "C:\temp\myfile.png" | ||
+ | </source> | ||
{|- | {|- |
Revision as of 22:21, 9 March 2020
Supported platforms:
Available since: Gideros 2012.8
Description
LFS or LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution.
LuaFileSystem offers a portable way to access the underlying directory structure and file attributes.
For more information and detailed documentation, please visit http://keplerproject.github.io/luafilesystem/manual.html#reference.
Example
local mypixel = Pixel.new(0xff0000, 1, 64, 64)
local myrt = RenderTarget.new(mypixel:getWidth(), mypixel:getHeight())
myrt:draw(mypixel)
local lfs = require "lfs"
lfs.chdir("c:/temp") -- on windows ("c:\\temp") also works
local dir = lfs.currentdir().."\\" -- append \
myrt:save(dir.."myfile.png") -- saved to "C:\temp\myfile.png"
Methods |
EventsConstants |