I've looked over the Lua & LuaFileSystem Docs and have yet to find a way to create a new file, I also scouted around on here but to the same end.
As a note, the solution I'm looking for has to be OS neutral to ensure portability, but I'm happy to get different answers for different systems.
Example (writing "Hello World" into test.txt):
$ lua
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> file = io.open("test.txt", "w")
> file:write("Hello World")
> file:close()
> ^D
$ cat test.txt
Hello World
See also: Lua IO tutorial
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With