saving data into "storage" is not working for me (solved)

Place to get help with not working mods / modding interface.
CyberWizard2261
Inserter
Inserter
Posts: 33
Joined: Tue Jun 26, 2018 11:01 am
Contact:

saving data into "storage" is not working for me (solved)

Post by CyberWizard2261 »

Can someone help me find what's wrong with my code? it looks like I can't save complex objects in the storage variable

Code: Select all

function tesseract_game:save()
	if self.tesseracts ~= nil then
		storage.tesseracts = self.tesseracts
	end
	if self.pointers ~= nil then
		storage.pointers = self.pointers
	end
end
I use this save method every time I modify the data but it looks like storage is only saving tesseracts and pointers with empty tables
Last edited by CyberWizard2261 on Thu Dec 19, 2024 10:16 am, edited 1 time in total.
Natha
Filter Inserter
Filter Inserter
Posts: 259
Joined: Sun Mar 15, 2015 1:48 pm
Contact:

Re: saving data into "storage" is not working for me

Post by Natha »

https://lua-api.factorio.com/latest/aux ... orage.html
There you find information which objects can be saved
CyberWizard2261
Inserter
Inserter
Posts: 33
Joined: Tue Jun 26, 2018 11:01 am
Contact:

Re: saving data into "storage" is not working for me (solved)

Post by CyberWizard2261 »

found the problem: I forgot to use script.register_metatable after setting the meta-table
Post Reply

Return to “Modding help”