Creeper9207

st

Feb 18th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. --Creeper9207 Code: database (API)--
  2. tDB = {}
  3. function setValue(database, key, value)
  4. local tFile = fs.open(database, "w")
  5. table.insert(tDB, key, value)
  6. tFile.write(textutils.serialize(tDB))
  7. tFile.flush()
  8. tFile.close()
  9. end
  10. function getValue(tDatabase, tKey)
  11. local tFile = fs.open(tDatabase, "r")
  12. local tData = tFile.readAll()
  13. tRealData = textutils.unserialize(tData)
  14. local value = tRealData[tKey]
  15. return value
  16. tFile.close()
  17. end
Advertisement
Add Comment
Please, Sign In to add comment