#How can i create "data schema"?

17 messages · Page 1 of 1 (latest)

tidal coyote
#
default_inventory = {
            last_equipped = {helmet_id = 1,armor_id = 1,sword_id = 1},
            last_inventory = {
                {0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0}
            }
        }```
i want to make inventory system. every item contains level, power, name. how can i create data schema like ```lua
local schema = {id=1, power=1, level=1, name="sword"}
``` and use it on table?
#

nevermind i solved.

lament marten
#

you have to split your static from dynamic data, basically

#

last_equipped = {helmet_id = 1,armor_id = 1,sword_id =
is by name dynamic data, if not, then consider renaming to default inventory

#

and in fact, actually getting it out of there in favour of flat tables

#

instead of dictionaries

#

this has to do with data normalization practices which I recommend you read on

#

for example is great tutorial if you're curious on the topic, this is massive when dealing with relational data like you're doing

fiery kestrel
lament marten
#

the reality tho, data normalization makes your data much more scalable, sure it has trade-offs, like anything

#

number of tables explode

#

but you can ensure your data is gonna be there, data's gonna be flat, and not data anomalies

#

which is huge

#

and if you have noticed, a shit ton of people come here asking why some piece of data they queried is not "there" or nil, this 100% solves that