Advertisement
StefanBashkir

Untitled

May 12th, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | None | 0 0
  1. local p = getfenv(
  2.     )['pcall'];
  3.  
  4. function count(o)
  5.     local lines = 0
  6.     for _, child in pairs(
  7.         o:GetChildren(
  8.             )
  9.         ) do
  10.         local passed, c = p(
  11.             count, child
  12.             )
  13.         if passed then
  14.             lines = lines + c
  15.         end
  16.     end
  17.     if o:IsA (
  18.         'BaseScript'
  19.         ) then
  20.         local source = o.Source
  21.         local S = {}
  22.         local rounds = math['ceil'](
  23.             source:len(
  24.                 )/1e4
  25.             )
  26.         for i = 1, rounds do
  27.             table.insert(
  28.                 S, source:sub(
  29.                     1e4 * (
  30.                         i-1
  31.                     ), 1e4*i
  32.                 )
  33.             )
  34.         end
  35.         for i = 1, rounds do
  36.             local value = S[i]
  37.             for _, char in pairs{
  38.                 value:byte(1, value:len(
  39.                    
  40.                 )
  41.                 )
  42.                 } do
  43.                 if char == 10 then
  44.                     lines = lines + 1
  45.                 end
  46.             end
  47.         end
  48.     end
  49.     return lines
  50. end
  51.  
  52.  
  53.  
  54.  
  55.  
  56. local start = tick();
  57. print(count(game))
  58. print(tick() - start)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement