Advertisement
melzneni

Turti Lib Database

Sep 16th, 2023 (edited)
1,074
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.45 KB | None | 0 0
  1. local pStorage
  2. local pSave
  3.  
  4. local api = {}
  5.  
  6. function api.loadValue(key)
  7.     return pStorage.data[key]
  8. end
  9.  
  10. function api.saveValue(key, value)
  11.     pStorage.data[key] = value
  12.     pSave()
  13. end
  14.  
  15. return {
  16.     name = "database",
  17.     api = api,
  18.     onInitPersistentStorage = function(_pStorage, _pSave)
  19.         pStorage = _pStorage
  20.         if not pStorage.data then
  21.             pStorage.data = {}
  22.         end
  23.         pSave = _pSave
  24.     end
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement