summaryrefslogtreecommitdiffstats
path: root/file.lua
diff options
context:
space:
mode:
authorKamil Kaminski <kamilkss@gmail.com>2011-12-11 03:33:38 -0600
committerKamil Kaminski <kamilkss@gmail.com>2011-12-11 03:33:38 -0600
commita78b14f8315d86b13ff9271659e84b2043f6bdc4 (patch)
tree076deba0bf951bbea398103ee4ee301ab5a67946 /file.lua
downloadlua-master.tar.gz
lua-master.tar.bz2
lua-master.zip
initial commitHEADmaster
Diffstat (limited to 'file.lua')
-rw-r--r--file.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/file.lua b/file.lua
new file mode 100644
index 0000000..6e55b3f
--- /dev/null
+++ b/file.lua
@@ -0,0 +1,10 @@
+-- writing to a file --
+fd = io.open("my.txt", "a")
+io.output(fd)
+io.write("a hello message from Lua, bro!\n")
+io.close()
+
+for line in io.lines("my.txt") do
+ print(line)
+end
+