Jump to content

fileWrite doesn't work


JeViCo

Recommended Posts

Hi guys!

I've recently tried to change file client-side however i got none.

meta.xml:

<meta>
    <script src="client.Lua" type="client" />
    <file src="testfile.txt" />
</meta>

testfile.txt (server-side):

sometext
here

client.Lua:

local file = fileOpen('testfile.txt')
fileClear(file) -- clear file
local content = 'some new text'
fileWrite(file, content)
print(#content) -- got 13
print(#fileRead(file, fileGetSize(file))) -- always get 0
fileClose(file)

acl.xml has resource.* permission and debug doesn't give any hints

any ideas??

 

 

i used this function (same happens if a recreate file)

 

Link to comment

Try this:

local file = fileOpen('testfile.txt')
fileClear(file) -- clear file
local content = 'some new text'
fileWrite(file, content)
print(#content) -- got 13
local fileContent = fileRead(file, fileGetSize(file)) 
fileClose(file)
print(#fileContent)

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...