Fooksie

cross-module playerdata storage

Apr 25th, 2014
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.47 KB | None | 0 0
  1. function readPDMulti(_string)
  2.     local PDgroup, width, i={}, 0, 1
  3.     while i<#_string do
  4.         width=_string:byte(i+1)*0x80+_string:byte(i+2)
  5.         PDgroup[_string:byte(i)]=_string:sub(i+3, i+2+width)
  6.         i=i+3+width
  7.         end
  8.     return PDgroup
  9.     end
  10. function writePDMulti(PDgroup)
  11.     local _string={}
  12.     for id, data in pairs(PDgroup) do
  13.         table.insert(_string, string.char(id, math.floor(#data/0x80), #data%0x80))
  14.         table.insert(_string, data)
  15.         end
  16.     return table.concat(_string)
  17.     end
Advertisement
Add Comment
Please, Sign In to add comment