Advertisement
Guest User

Untitled

a guest
May 28th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.14 KB | None | 0 0
  1. --------------------------------------------------------------------------------
  2. --------------------------------------------------------------------------------
  3.  
  4. function gadget:GetInfo()
  5.   return {
  6.     name      = "Action Queuer",
  7.     desc      = "",
  8.     author    = "quantum",
  9.     date      = "Apr 27, 2010",
  10.     license   = "GNU GPL, v2 or later",
  11.     layer     = -1,
  12.     enabled   = true  --  loaded by default?
  13.   }
  14. end
  15.  
  16. --------------------------------------------------------------------------------
  17. --------------------------------------------------------------------------------
  18.  
  19. if not gadgetHandler:IsSyncedCode() then
  20.   return
  21. end
  22.  
  23. local pendingActions = {}
  24.  
  25. function GG.SafeAction(f)
  26.   pendingActions[#pendingActions + 1] = f
  27. end
  28.  
  29.  
  30. function gadget:GameFrame(currentFrame)
  31.   if currentFrame > 1 then -- only execute actions when the game has started
  32.     for _, action in ipairs(pendingActions) do
  33.       action()
  34.     end
  35.     pendingActions = {}
  36.   end
  37. end
  38.  
  39. --------------------------------------------------------------------------------
  40. --------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement