Advertisement
StefanBashkir

Untitled

May 12th, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. function count(o)
  2.     local lines = 0
  3.     for _, child in pairs(o:GetChildren()) do
  4.         local passed, c = pcall(count, child)
  5.         if passed then
  6.             lines = lines + c
  7.         end
  8.     end
  9.     if o:IsA 'BaseScript' then
  10.         local S = {}
  11.         if o.Source:len() > 10000 then
  12.             local rounds = math['ceil'](o.Source:len()/10000)
  13.             for i = 1, rounds do
  14.                 table.insert(S, o.Source:sub(10000 * (i-1), 10000*i))
  15.             end
  16.         else
  17.             S = {o.Source}
  18.         end
  19.         for each, andeveryone in pairs(S) do
  20.             for _, char in pairs{andeveryone:byte(1, andeveryone:len())} do
  21.                 if char == 10 then
  22.                     lines = lines + 1
  23.                 end
  24.             end
  25.         end
  26.     end
  27.     return lines
  28. end
  29.  
  30. print(count(game))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement