Advertisement
Tapeline

Копипаст с какого-то форума (ttf)

Oct 8th, 2021
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. local serialization = require("serialization")
  2.  
  3. local tableToFile = {}
  4.  
  5. function tableToFile.load(location)
  6.   --returns a table stored in a file.
  7.     local tableFile = assert(io.open(location))
  8.       return serialization.unserialize(tableFile:read("*all"))
  9.       end
  10.            
  11. function tableToFile.save(table, location)
  12.               --saves a table to a file
  13.                 local tableFile = assert(io.open(location, "w"))
  14.                   tableFile:write(serialization.serialize(table))
  15.                     tableFile:close()
  16.                     end
  17.                                  
  18.                                   return tableToFile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement