...other than infolog.txt?
and other than stdout which i cant find in windows xp (how do i direct it into a file?)
can spring lua write text to files?
Moderator: Moderators
Re: can spring lua write text to files?
Yes, LuaUI (and LuaUI only) can write to arbitrary (text) files in the Spring directory.
You should be able to redirect stdout by doing on a console:
You should be able to redirect stdout by doing on a console:
Code: Select all
spring.exe > mystdout.txt
Re: can spring lua write text to files?
thanks, stdout works now. but spring already writes stuff into it so thats not so great.
How would LuaUI writing to text files work?
Only thing I about lua and file acess is http://springrts.com/wiki/Lua_VFS and it seems about reading modfiles
Basically I am just looking for something like
file=openfile("bla.txt")
Spring.Writefile (file, "dumdidumdidum")
edit
ah think i found it
How would LuaUI writing to text files work?
Only thing I about lua and file acess is http://springrts.com/wiki/Lua_VFS and it seems about reading modfiles

Basically I am just looking for something like
file=openfile("bla.txt")
Spring.Writefile (file, "dumdidumdidum")
edit
ah think i found it
Re: can spring lua write text to files?
Code: Select all
fd= io.open(filename)
if fd then
fileopened=true
else
Echo("Opening " ..filename.. " failed")
fileopened=false
end
Re: can spring lua write text to files?
thanks Beherith, but I would have still needed the write command
Anyway, got it working this way:
the "w" is needed, otherwise it says error trying to index lala

Anyway, got it working this way:
I had also found this in google:file = io.open ("file.txt","w")
file:write("blabla")
file:close()
which didnt work.k = openfile("bla.txt","r")
print(k)
the "w" is needed, otherwise it says error trying to index lala
Re: can spring lua write text to files?
io.open can operate in read-only (IIRC, it does by default). See Lua Reference.k = openfile("bla.txt","r")
print(k)