Phodex Games Posted January 29, 2017 Share Posted January 29, 2017 Hi there, I have a problem, maybe you guys can help me. I will make it quick. Following is what I have (just an example): function Script:Start() FileSystem:CreateFile("Data/Save Data/someData.lua") self.stream = FileSystem:WriteFile("Data/Save Data/someData.lua") end function Script:UpdateWorld() --I created this to find the error and to test it out if window:KeyHit(Key.K) then self.stream:WriteLine("Some text goes here") System:Print("It should work!") end end So I get printed "It should work!" AND the file gets created, but I can click "K" as often as I want, the text which should be written does not show up in the file. I need this to save data for my game. Whats the mistake. I noticed, that sometimes it gets written, after I close the application, but sometimes is has also been written while "ingame", but mostly it doesnt, especially with the scenario you can see above. Anyways this stream:WriteLine() seams to behave very akward. Further then solving my problem, what are your solutions for saving massive, or not so massive data (object positions, player position, npc states etc)? Thanks for your answers! EDIT: Just checked the data file again, and now the data is written a hundred times??? But I triple check if it gets written after I pressed "K". The problem is I need the file to be written immediately, because I grab the file again with dofile (I normally write code into the file that gets called (a simple "return" and some data)) Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted January 29, 2017 Share Posted January 29, 2017 Sounds like you are in sandbox mode. Files get written after the program closes instead of during the game. This also goes for system preferences Quote Link to comment Share on other sites More sharing options...
Josh Posted January 29, 2017 Share Posted January 29, 2017 Actually, files will only be written when the Steam is released. In Sandbox mode, the files won't open at all. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Phodex Games Posted January 30, 2017 Author Share Posted January 30, 2017 Ah okey I will try to release the stream, that could make it ^^. I have sandbox mode disabled, thats not the problem. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.