Advertisement
a_alien

startup.lua

Apr 23rd, 2021
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | None | 0 0
  1. -- Variabels
  2. local x = 0
  3. local y = 0
  4. local z = 0
  5.  
  6. -- Util Functions
  7.  
  8. -- Functions
  9.  
  10.  
  11.  
  12. function save()
  13.     file = io.open("loc", "w+")
  14.     while file==nil do end
  15.     file.write("x: "+tostring(x))
  16.     file.write("y: "+tostring(y))
  17.     file.write("z: "+tostring(z))
  18. end
  19.  
  20. function load()
  21.     file = io.open("loc", "r")
  22.     while file==nil do end
  23.     for i in file.lines() do
  24.         if string.starts(i, "x: ") then
  25.             x = string.sub(i, 3)
  26.         elseif string.starts(i, "y: ") then
  27.             y = string.sub(i, 3)
  28.         elseif string.starts(i, "z: ") then
  29.             z = string.sub(i, 3)
  30.         end
  31.     end
  32. end
  33.  
  34. -- Loop
  35.  
  36. save()
  37. load()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement