Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[Solved]How do I save a metatable to a datastore?

Asked by 5 years ago
Edited 5 years ago

I looked it up recently and what I read said that datastores cannot store metatables. Is there anything that I can substitute in a way that wont break my script? By the way I am only saving a list of numbers. Could someone help me out please? Thanks!

1 answer

Log in to vote
0
Answered by 5 years ago

save the metatable as a table, meaning you save 2 tables, one is the actual table, the second one is the metatable

{
    Table = { 
        1,
        "hello",
        123.45
    }
    Table_Meta = {
        __add = function(a, b)
            warn("foo")
            return 123
        end,
        __index = error("no")
    }
}
0
Sorry but that wont work for what I am trying to do. Thanks for your help though. User#21908 42 — 5y
Ad

Answer this question