Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local meta = {}
- meta.__index = meta
- local T = setmetatable({}, meta) -- T is the actual table you use
- T[asd] = 5 -- new change gets saved inside T
- func OnSave()
- local meta = getmetatable(T)
- local keystodel = {}
- for k,v in pairs(T) do -- save the data and move it to metatable
- Save(k, v)
- meta[k] = v
- table.insert(keystodel, k)
- end
- for k,v in ipairs(keystodel) do -- not to confuse above loop saved all keys to a table and now deleting them
- T[v] = nil
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement