Forum

> > CS2D > Scripts > Error in save data script
Forums overviewCS2D overview Scripts overviewLog in to reply

English Error in save data script

3 replies
To the start Previous 1 Next To the start

old Error in save data script

Joni And Friends
User Off Offline

Quote
hello us ,
I get confused with error in my script, the error apear like this:
1
2
3
4
[01:10:44] LUA ERROR: sys/lua/JAF-OtherWorld/power.lua:623: attempt to use a closed file
[01:10:44]  -> [C]: in function 'write'
[01:10:44]  -> sys/lua/JAF-OtherWorld/power.lua:623: in function '?'
[01:10:44]  -> sys/lua/JAF-OtherWorld/start.lua:435: in function <sys/lua/JAF-OtherWorld/start.lua:22>
I dont undestand what the error of my script?
Anyone can explain what error is it?

old Re: Error in save data script

GeoB99
Moderator Off Offline

Quote
Closing a file with
file:close()
or
io.close(filename)
just prior to the file being read or written can't be accessed with write/read functions again because the file and its data is no longer in the memory stack. Any use of further I/O handlers after the file is closed will cause an error.

Judging by the error output use this piece of chunk
local file = assert( io.open(filename, 'w') )
to re-open again the file or show us the bugged code so we can take a look what exactly you did.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview