How do you read a txt file

Or an xml file, or anything. I get to file:open(file) but how do you access the attributes in it.
I dont need anything complex like a database or anything. Just reading a simple txt or xml file is more than enough.

This question is better suited for google.

I think he means as in how to get a resource to read a txt file, for permissions or something…

yes, obviously i can open a damn textfile with notepad but how am i supposed to make a resource read it.
Like mta had xmlFindChild or xmlLoadFile and other stuff…

Afaik there is no XML handler for now…

But you can access the raw content of files with these:

To read a file just use this native: LoadResourceFile

And to save a file use this native: SaveResourceFile

On server side you can use C# to do the trick.

On client-side there is the XML Parser from https://github.com/friendsincode/ELS-Plus

Which is like 3MB, you can better use json files and use the json dot net stuff, which is like 400kb.

i have no idea how to use json. Do you have a link or smth of a good example?

I forgot to say that lua also offers with json.decode / json.encode the possibility of loading json directly into a table or from a table converting it to a string.

If you are using C# I recommend using json dot net, basically the top library in nuget. But the portable Sl5 version for .Net40 as it loads on the client too.