add a lua module example myfile.lua

This commit is contained in:
funshine 2014-11-24 00:30:49 +08:00
parent 2671c0c141
commit 8dbe8b67ce
1 changed files with 12 additions and 0 deletions

12
examples/myfile.lua Normal file
View File

@ -0,0 +1,12 @@
--myfile.lua
local myfile = {}
function myfile.print(name)
file.open(name)
repeat
local line=file.readline()
if line then line=(string.gsub(line,"\n","")) print(line) end
until not line
file.close()
end
return myfile