So, i want to create a txt, that will keep tracks on the number of restats.
I have already catched the attribute points (using matches with i=2,3 etc)
I have failed to create the file, using the io library in general
So can somebody help me, with writing a basic code that:
a)creates/opens the file
b)writes a line on the bottom of the file.
For more advanced usage, i want to keep track and the number of the times that it has written the file (or something similar that will actually numerize the times that i have statted)
Creating and writing on a text file
Re: Creating and writing on a text file
Check out the pinned Lua tutorial topic. It's fairly easy. http://forums.mudlet.org/viewtopic.php?f=9&t=641
especially this one: http://lua-users.org/wiki/IoLibraryTutorial
Note that you also have access to the Lua LFS library (Lua File System) as it's loaded by new versions of Mudlet.
http://keplerproject.github.com/luafilesystem/
especially this one: http://lua-users.org/wiki/IoLibraryTutorial
Note that you also have access to the Lua LFS library (Lua File System) as it's loaded by new versions of Mudlet.
http://keplerproject.github.com/luafilesystem/
Re: Creating and writing on a text file
Thanks i ll try it, but where does lua create the file?
Re: Creating and writing on a text file
so i made an alias to write this
P.S. what unzip function in LuaGlobal.lua
but...nothing happens. I am not sure what to do, or actually, where to start from, i have tried to create by myself a txt file named statting, named statting.txt, inside the mudlet directory (is it really a concern) but still, nothing happened.
P.S. what unzip function in LuaGlobal.lua
Re: Creating and writing on a text file
Maybe try doing f:flush() before closing the file?
Re: Creating and writing on a text file
did, but didn't help
Edit, i found the txt file, it was on the mudlet dir, that for some reason is stored in a wierd place
thanks for the help
Edit, i found the txt file, it was on the mudlet dir, that for some reason is stored in a wierd place

Re: Creating and writing on a text file
Is open() returning a valid file handle? Test if f is nil.
Re: Creating and writing on a text file
Everything is working, thanks for the help