Create a file within lua?

(1/1)

pspking2k8:
I don't know if its possible, but can you create files from within lua? i.e. Something like...

Code:

system:filecreate("Newfile.txt")

Thanks

dan369:
i don't think u can, there's a copy & delete function though, look through LuaplayerHM documentation, thats your best bet at finding out if there is.

TyPR124:
I think if you use

io.open() it will create a new file if it doesn't exist

Buddy4point0:
You could probably do something like
Code:

System.writeFile (source, destination, remove)
Use it like:
Code:

System.writeFile ("script.lua", "save.lua", "no")
file = io.open("save.lua","w")
file:write("save your data here")
file:close()


That 'should' create (copy) a new file and let you put your own text in it.

pspking2k8:
Quote from: Buddy4point0 on November 23, 2008, 10:48:11 AM

You could probably do something like
Code:

System.writeFile (source, destination, remove)
Use it like:
Code:

System.writeFile ("script.lua", "save.lua", "no")
file = io.open("save.lua","w")
file:write("save your data here")
file:close()


That 'should' create (copy) a new file and let you put your own text in it.



Didn't work...

Found this: http://wiki.ps2dev.org/psp:lua_player:functions#system. But I think its out of date. Where can I find this LuaplayerHM documentation?

Edit: Solved.
Code:

file = io.open("save.lua", "w")
file:write("save your data here")
file:close()

Navigation

[0] Message Index