Reading a raw text file
This extremely simple script displays the contents of a text file. This is only to demonstrate how to read a file.
main script (no init script needed)
The script does not test if the file is there ... it really should be. All it does is read all the file contents into the variable "buffer" and return it. Of course you can do everything with the buffer you want.
As noted, leave the init script field empty. The "IO Library" box has to be checked in the options dialog, it contains the file functions.
main script (no init script needed)
buffer = ""
-- read news.xml
for line in io.lines("c:\\samurize\\news.xml") do buffer = buffer .. line end
return bufferThe script does not test if the file is there ... it really should be. All it does is read all the file contents into the variable "buffer" and return it. Of course you can do everything with the buffer you want.
As noted, leave the init script field empty. The "IO Library" box has to be checked in the options dialog, it contains the file functions.
Subtitles
