Forum

> > CS2D > Scripts > file:write help
Forums overviewCS2D overview Scripts overviewLog in to reply

English file:write help

3 replies
To the start Previous 1 Next To the start

old file:write help

Blighted Song
User Off Offline

Quote
I'm having a bit of trouble with the file:write fuunction.
Im doing this
1
2
3
4
deaths[id]=deaths[id]+1
	file = io.open('sys/lua/data/'..player(id,"usgn")..'.txt','w')
	file:write(deaths[id].." /n "..kills[id])
	file:close()

which should write(for example):
5
10
to the file as far as I can tell, however it instead writes:
5 /n 10

Going over tutorials and the reference manual it said it should produce the first result, but it doesn't.

What am I doing wrong?

old Re: file:write help

Flacko
User Off Offline

Quote
You don't need to concatenate the string you're writing.
Using
1
file:write(deaths[id],"\n",kills[id])
Looks better, nicier and it's faster too.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview