Go to Page... |
Updated: | 01-20-13 07:55 AM |
Created: | 09-09-12 03:26 AM |
Downloads: | 1,959 |
Favorites: | 1 |
MD5: |
Library to make access to saves easy. Frequently when author accessing saved variable like "MySavedVariablePerChar.node_root.node2.somevalue" it is necessary to check is all intermediate nodes not nil. On storing same checks and initializing of tables. On erasing variables or nodes to prevent garbage of empty nodes should be done lot of checks and actions.
This simple library can do it for you. Sample
local es = LibStub("EasyStorage-1.2", false) MyAddon_SavedVariablesPerCharacter = MyAddon_SavedVariablesPerCharacter or {} MyAddonPerChar = es:New(MyAddon_SavedVariablesPerCharacter) MyAddon_SavedVariablesGlobal = MyAddon_SavedVariablesGlobal or {} MyAddonGlobal = es:New(MyAddon_SavedVariablesGlobal) ... value1 = MyAddonPerChar:Get({"node_root", "node2"}, true) value2 = MyAddonGlobal:Get({"node_root", "node3"}, 10) ... MyAddonPerChar:Set({"node_root", "node1"}, nil) MyAddonPerChar:Set({"node_root", "node2"}, some_value) MyAddonPerChar:Set({"node_root", "node3"}, 20) MyAddonPerChar:Set({"node_root", "node4"}, "some text") local node_by_name = "something" MyAddonGlobal:Set({"node_root", node_by_name}, {}) MyAddonGlobal:Set({"node_root", "very_deep_node", 1, 2, 3, 4, 5, 6}, {["var"] = 60}) ... MyAddonGlobal:Set("node_root.very_deep_node.1.2.enabled", true)
There have been no comments posted to this file.
Be the first to add one. |