Jump to content

[HELP] How to save table datas?


Recommended Posts

Can you save through XML. here's an example:

function saveTable()
	local loadFile = xmlLoadFile("save.xml", "root")
	if not (loadFile) then
		loadFile = xmlCreateFile("save.xml", "root")

	for i, v in ipairs(ourTable) do -- change 'ourTable' to your table name
	    local createChild = xmlCreateChild(loadFile, "vehicle")

	    xmlNodeSetAttribute(createChild, "x", v.x) -- v.x is your table value, just change it
	    xmlNodeSetAttribute(createChild, "y", v.y)
	    xmlNodeSetAttribute(createChild, "z", v.z)
addCommandHandler("rsave", saveTable)


Edited by Geteco
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...