Advertisement
Rochet2

Foe table loop

Aug 29th, 2014
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. local SafeLoc = {
  2.     [1] = {1},
  3.     [2] = {},
  4.     [3] = {3, 8},
  5. };
  6.  
  7. -- Process SafeLocs on startup
  8. local temp = {}
  9. for k,v in pairs(SafeLoc) do
  10.     if (#v <= 0) then
  11.         temp[k] = true
  12.     else
  13.         temp[k] = temp[k] or {}
  14.         for i,j in ipairs(v) do
  15.             temp[k][j] = true
  16.         end
  17.     end
  18. end
  19. SafeLoc = temp
  20.  
  21. local playerZone, playerArea = 3, 3
  22.  
  23. if(SafeLoc[playerZone]) then
  24.     if(SafeLoc[playerZone] == true) then
  25.         print("No safe area but player is in safe zone")
  26.     else
  27.         if (SafeLoc[playerZone][playerArea]) then
  28.             print("Player is in safe zone and area")
  29.         end
  30.     end
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement