From 8dbe8b67cec5e9696f73ac16c953d00f7ed5b199 Mon Sep 17 00:00:00 2001 From: funshine Date: Mon, 24 Nov 2014 00:30:49 +0800 Subject: [PATCH] add a lua module example myfile.lua --- examples/myfile.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 examples/myfile.lua diff --git a/examples/myfile.lua b/examples/myfile.lua new file mode 100644 index 00000000..0e0e7e0b --- /dev/null +++ b/examples/myfile.lua @@ -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