Advertisement
Descaii

Function Library

Sep 17th, 2014
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | None | 0 0
  1. --[[ Function Storage ]]--
  2.  
  3.  
  4.  
  5. -- Recursive Children --
  6. function GetRecursiveChildren(P)
  7.     local n,t,G={},table.foreach
  8.     function G(c,p)
  9.         table.insert(n,p)
  10.         t(p:GetChildren(),G)
  11.     end
  12.     t(P:GetChildren(),G)
  13.     return n
  14. end
  15.  
  16.  
  17. --[[ Lerps ]]--
  18.  
  19. -- lerp --
  20. function lerp(a,b,c)
  21.     return a+(b-a)*c
  22. end
  23.  
  24. -- colerp --
  25. function colerp(a,b,c)
  26.     return Color3.new(a.r+(b.r-a.r)*c,a.g+(b.g-a.g)*c,a.b+(b.b-a.b)*c)
  27. end
  28.  
  29. -- glerp --
  30. function glerp(a,b,c)
  31.     local axs,axo,ays,ayo,bxs,bxo,bys,byo=a.X.Scale,a.X.Offset,a.Y.Scale,a.Y.Offset,b.X.Scale,b.X.Offset,b.Y.Scale,b.Y.Offset
  32.     return UDim2.new(axs+(bxs-axs)*c,axo+(bxo-axo)*c,ays+(bys-ays)*c,ayo+(byo-ayo)*c)
  33. end
  34.  
  35. -- vlerp --
  36. function vlerp(a,b,c)
  37.     local x=pcall(function()return a.Z end)
  38.     local d=x and Vector3.new or Vector2.new
  39.     return d(a.X+(b.X-a.X)*c,a.Y+(b.Y-a.Y)*c,x and a.Z-(b.Z-a.Z)*c)
  40. end
  41.  
  42. -- clerp --
  43. function clerp(a,b,m)
  44.     local c,d={a:components()},{b:components()}
  45.     table.foreach(c,function(a,b)c[a]=c[a]+(d[a]-c[a])*m end)
  46.     return CFrame.new(unpack(c))
  47. end
  48.  
  49.  
  50. --[[ |Lerps end| ]]--
  51.  
  52. -- Get All BrickColors --
  53. function GetAllBrickColors()
  54.     local T={}
  55.     for r=1,255,10 do for g=1,255,10 do for b=1,255,10 do
  56.         local C=BrickColor.new(r/255,g/255,b/255)
  57.         if not T[C.Name] then
  58.             T[C.Name]=C.Name
  59.         end
  60.     end end end
  61.     return T
  62. end
  63.  
  64. -- sleep --
  65. function sleep(T)
  66.     local n = tick()
  67.     repeat coroutine.yield() until tick()-n>(T or 0)
  68.     return tick()-n
  69. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement