SHARE
TWEET

qlib.lua

a guest Nov 19th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local X = {}
  2.  
  3. function len(t)
  4.   local i = 1
  5.   while t[i] ~= nil do i = i + 1 end
  6.   return i
  7. end
  8. X.len = len
  9.  
  10. function keysvals(t)
  11.   local i = 1
  12.   local ks = {}
  13.   local vs = {}
  14.   for k,v in pairs(t) do
  15.     ks[i] = k; vs[i] = v; i = i + 1
  16.   end
  17.   return ks,vs
  18. end
  19. X.keysvals = keysvals
  20.  
  21. function tprint(t)
  22.   local i = 1
  23.   local ks
  24.   local vs
  25.   ks,vs = keysvals(t)
  26.   while ks[i] ~= nil do
  27.     print(ks[i].." : "..vs[i])
  28.   end
  29. end
  30. X.tprint = tprint
  31.  
  32. return X
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top