Log Function and Creating files

I have been working on this for a few days now and I could not come up with any way to open text files to read or to write to them, I have been trying to implement this in order to create a function that will save a person's data once they exit out of the game and they will be able to come back to it later on and play their equipment that they had before. if anyone knows anything about this topic please comment, anything would be helpful.

Comments

  • File access functions are intentionally not available to prevent "rogue" scripts from modifying your system. So what you are trying to do is impossible without some new functions.
  • What daid says is totaly right.

    But as you are saying you are looking for any way... There are two ways that you could do that, but both require coding skills, are a little "hacky" and come with a smell:

    1. You might consider using the HTTP Api. It's up to you if you write a webpage with nice buttons or use the API directly with any scripting language of your liking.

    2. An other way you might use (if you really hate yourself and good code in general) is using the log to stdout your data, then write something to convert it into a lua file that you require on startup. But, seriously... don't do that! Use the HTTP Api if possible.

    But you would need to take care of serializing/deserializing the data on your own in both cases.

    Hope that helps somehow...
    Christian
Sign In or Register to comment.