Overkillz Posted October 8, 2017 Share Posted October 8, 2017 Hello guys, well, my question is simple. Im saving a file on the client folder and it is teaEncoded. Well, this fille can be modified by the user writing on it ...etc However, I want to prevent this while it is read. My idea is to get the bool value using teaDecode. However, Im always getting that the file is Ok even if it is modified by the user (In this case me) Im not sure if you understand me. Here is my code function loadMapFromCache(wha) if wha then local pathMap = tostring("asd/dsa/"..wha..".wah") if fileExists(pathMap) then file = fileOpen(pathMap) if file then local fileR = fileRead(file, fileGetSize(file)) fileR = teaDecode( fileR, temporalTeaCode ) fileClose(file) if fileR then outputChatBox("Is Ok") else outputChatBox("Is wrong") end end end end end Link to comment
Moderators IIYAMA Posted October 9, 2017 Moderators Share Posted October 9, 2017 (edited) teaDecode will decode everything. Just it is looks like it is messed up if you changed it before decoding. The easiest way is to compare fileR with the original file. Or compare the file size. Edited October 9, 2017 by IIYAMA Link to comment
Overkillz Posted October 9, 2017 Author Share Posted October 9, 2017 Yes, I was already aware about doing a trigger but I wanted to avoid that. Luckily I could do it checking if the files was successfully teaDecoded and checking if the variable is a table. Looks like it works pretty good and I don't need to trigger it. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now