Advertisement
Guest User

Untitled

a guest
Sep 29th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 0 0
  1. -- hypothetical behavior of getPlayerIp
  2. function getPlayerIp(cid)
  3.     return cid
  4. end
  5.  
  6. killRewardToken = {} --
  7.  
  8. ---------------------------------
  9. -- this would go in a global or compat
  10.  
  11. -- constructor, you would want to call this up 1st
  12. function killRewardToken.new()
  13.     local temp = {} -- empty table,
  14.     -- construct our metatable
  15.     setmetatable(temp, killRewardToken)
  16.  
  17. end
  18.  
  19. -- this is to set the ip as the index of the metatable killRewardToken, with an initial value of current time
  20. function killRewardToken:SetTable(cid)
  21.     self[getPlayerIp(cid)] = os.time()
  22. end
  23.  
  24. -- this just current time stored in killRewardToken
  25. function killRewardToken:get(cid)
  26.     return self[getPlayerIp(cid)]
  27. end
  28. -----------------------------
  29.  
  30. killRewardToken.new()
  31. killRewardToken:SetTable(123)
  32. print(killRewardToken:get(123))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement