Large Meta-Table Serialization
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- CanadianGamer
- Party member
- Posts: 132
- Joined: Tue Jun 30, 2015 1:23 pm
- Location: Canada
- Contact:
Large Meta-Table Serialization
So I'm making a game that requires a fairly sizeable meta table to store game information in this meta table has arrays in it which also have more meta tables and integers etc. My question is how to serialize this. I've tried googling and searching the forums but it seems that most serialization libraries don't support meta tables. Any help would be appreciated.
My serious itch.io page:
https://pentamonium-studios.itch.io/
My less serious itch.io page:
http://canadiangamer.itch.io
https://pentamonium-studios.itch.io/
My less serious itch.io page:
http://canadiangamer.itch.io
Re: Large Meta-Table Serialization
Serialization is usually for data whereas metatables are not data, but moreover define the behavior when accessing and assigning keys in a table.
I think you need to include your code so we can see if what you're doing makes sense.
I think you need to include your code so we can see if what you're doing makes sense.
- CanadianGamer
- Party member
- Posts: 132
- Joined: Tue Jun 30, 2015 1:23 pm
- Location: Canada
- Contact:
Re: Large Meta-Table Serialization
I'm not sure I was using the right terminology when I said meta tables but in any case, what I meant was something like this
Code: Select all
table1 = {field1 = 2, field2 = 1}
My serious itch.io page:
https://pentamonium-studios.itch.io/
My less serious itch.io page:
http://canadiangamer.itch.io
https://pentamonium-studios.itch.io/
My less serious itch.io page:
http://canadiangamer.itch.io
-
- Party member
- Posts: 559
- Joined: Wed Oct 05, 2016 11:53 am
Re: Large Meta-Table Serialization
That's just a regular lua table, or perhaps in other words an associative array or dictionary. All tables in lua store data with key/value pairs, and you can read more about it here and here with examples.
As for your question, yes, you can serialize tables fairly easily, for example by using bitser, or just about any other serializer listed here.
You can read what meta tables (and meta methods) actually are from lua docs. For a lot of use cases you could just serialize the actual data in the table, and set the relevant meta tables or methods at run time after the data has been deserialized.
As for your question, yes, you can serialize tables fairly easily, for example by using bitser, or just about any other serializer listed here.
You can read what meta tables (and meta methods) actually are from lua docs. For a lot of use cases you could just serialize the actual data in the table, and set the relevant meta tables or methods at run time after the data has been deserialized.
- zorg
- Party member
- Posts: 3468
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Large Meta-Table Serialization
Also, tables in tables are often called nested tables instead.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], zingo and 7 guests