Advertisement
mathiaas

s02_functions

Aug 2nd, 2020 (edited)
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | None | 0 0
  1. function getPos()
  2.     file = io.open("/.pos", "r")
  3.     line = file:read()
  4.     file:close()
  5.     return line
  6. end
  7.  
  8. function setPos(x,y,z,f)
  9.     coords = x .. "," .. y .. "," .. z .. "," .. f
  10.     file = io.open("/.pos","w")
  11.     file:write(coords)
  12.     file:close()
  13. end
  14.  
  15. function split(_string)
  16.   local _arr = {}
  17.   for i in string.gmatch(_string, '([^,]+)') do
  18.     table.insert(_arr,i)
  19.   end
  20.   return _arr
  21. end
  22.  
  23. function getYPos()
  24.     return tonumber(split(getPos())[2])
  25. end
  26.  
  27. function getFPos()
  28.     return tonumber(split(getPos())[4])
  29. end
  30.  
  31. function reverseList(list)
  32.     reversedList = {}
  33.     for i = #list,1,-1 do
  34.         table.insert(reversedList,list[i])
  35.     end
  36.     return reversedList
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement