• Print

Author Topic: Current code amount standings  (Read 5654 times)

0 Members and 1 Guest are viewing this topic.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Current code amount standings
« on: September 05, 2007, 05:38:40 pm »
As of right now, these are the results of how many lines are in ULib and ULX.

First, ULib:
Code: [Select]
lua/autorun/ulib_init.lua       5
lua/ULib/client/autocomplete.lua        16
lua/ULib/client/cl_util.lua     56
lua/ULib/client/draw.lua        26
lua/ULib/client/uroundbutton.lua        85
lua/ULib/client/uroundmenu.lua  16
lua/ULib/cl_init.lua    35
lua/ULib/init.lua       83
lua/ULib/server/concommand.lua  110
lua/ULib/server/entity_ext.lua  93
lua/ULib/server/hook.lua        91
lua/ULib/server/phys.lua        45
lua/ULib/server/player.lua      108
lua/ULib/server/player_ext.lua  55
lua/ULib/server/ucl.lua 456
lua/ULib/server/util.lua        74
lua/ULib/shared/concommand.lua  109
lua/ULib/shared/defines.lua     30
lua/ULib/shared/messages.lua    72
lua/ULib/shared/misc.lua        126
lua/ULib/shared/player.lua      95
lua/ULib/shared/sh_ucl.lua      137
lua/ULib/shared/tables.lua      79
lua/ULib/shared/util.lua        63
lua/ULib/_cl_2.06/_generator.lua        15
------------
2080

Now ULX:
Code: [Select]
lua/ULib/modules/ulx_init.lua   5
lua/ulx/base.lua        126
lua/ulx/cl_accessmenu.lua       61
lua/ulx/cl_init.lua     19
lua/ulx/cl_lib.lua      235
lua/ulx/end.lua 33
lua/ulx/init.lua        37
lua/ulx/lib.lua 57
lua/ulx/modules/cl/adminmenu.lua        0
lua/ulx/modules/cl/clientmenu.lua       46
lua/ulx/modules/cl/cl_menu.lua  274
lua/ulx/modules/cl/mainmenu.lua 43
lua/ulx/modules/cl/mapsmenu.lua 26
lua/ulx/modules/cl/motdmenu.lua 49
lua/ulx/modules/fun.lua 1230
lua/ulx/modules/log.lua 217
lua/ulx/modules/slots.lua       71
lua/ulx/modules/toolmode.lua    73
lua/ulx/modules/util.lua        813
lua/ulx/modules/vote.lua        193
lua/ulx/sh_defines.lua  30
------------
3638

So, between both of them, 5718.

About the results:
This is ONLY counting lua files (not the readme sorry :() and ONLY counting lines that actually have code on them. Whitespace and comments are excluded from this. Here's the program if you're interested, just change the path of the mod dir it's reading.

Code: Lua
  1. local function filesInDir( dir, recurse, root )
  2.         if not file.IsDir( dir ) then
  3.                 return nil
  4.         end
  5.  
  6.         local files = {}
  7.         local relDir
  8.         if root then
  9.                 relDir = string.gsub( dir, root .. "[\\/]", "" )
  10.         end
  11.         root = root or dir
  12.  
  13.         local result = file.Find( dir .. "./*" )
  14.  
  15.         for i=1, #result do
  16.                 if file.IsDir( dir .. "./" .. result[ i ] ) and recurse then
  17.                         files = table.Add( files, filesInDir( dir .. "/" .. result[ i ], recurse, root ) )
  18.                 else
  19.                         if not relDir then
  20.                                 table.insert( files, result[ i ] )
  21.                         else
  22.                                 table.insert( files, relDir .. "/" .. result[ i ] )
  23.                         end
  24.                 end
  25.         end
  26.  
  27.         return files
  28. end
  29.  
  30. local globalcount = 0
  31. local t = filesInDir( "../addons/ulx", true )
  32. for _, path in ipairs( t ) do
  33.         if path:sub( -4 ) == ".lua" then
  34.                 local f = file.Read( "../" .. path )
  35.                 f = ULib.stripComments( f, "--", "--[[", "]]" )
  36.                 f = ULib.stripComments( f, "//", "/*", "*/" )
  37.                 f = string.Explode( "\n", f )
  38.                
  39.                 local count = 0
  40.                 for _, line in ipairs( f ) do
  41.                         if string.find( line, "%S" ) then
  42.                                 count = count + 1
  43.                         end
  44.                 end
  45.                 print( path, count )
  46.                 globalcount = globalcount + count
  47.         end
  48. end
  49. print( "------------\n" .. globalcount )
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Current code amount standings
« Reply #1 on: November 26, 2009, 06:44:21 pm »
Megiddo, since converting to our new command system in SVN as of this moment, I'm curious about new counts.
Though I expect some ULib files to have grown, I would expect several of the ULX modules to have shrunk slightly.
I'm guessing that what we used to do in about 8-12 lines of code for input/parameter checking within every function has now been reduced to 5-6 lines of code.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Current code amount standings
« Reply #2 on: December 29, 2009, 09:50:21 pm »
In my quest to continue the "better late than never philosophy"...

ULib:
Code: [Select]
lua/autorun/ulib_init.lua 5
lua/ULib/client/autocomplete.lua 7
lua/ULib/client/cl_util.lua 105
lua/ULib/client/commands.lua 3
lua/ULib/client/draw.lua 26
lua/ULib/client/player_ext.lua 4
lua/ULib/cl_init.lua 39
lua/ULib/init.lua 96
lua/ULib/server/concommand.lua 110
lua/ULib/server/entity_ext.lua 137
lua/ULib/server/gamemode_hooks.lua 11
lua/ULib/server/hook.lua 103
lua/ULib/server/phys.lua 45
lua/ULib/server/player.lua 236
lua/ULib/server/player_ext.lua 61
lua/ULib/server/ucl.lua 502
lua/ULib/server/upgrade.lua 47
lua/ULib/server/util.lua 151
lua/ULib/shared/commands.lua 551
lua/ULib/shared/concommand.lua 112
lua/ULib/shared/defines.lua 60
lua/ULib/shared/messages.lua 115
lua/ULib/shared/misc.lua 277
lua/ULib/shared/player.lua 150
lua/ULib/shared/sh_ucl.lua 90
lua/ULib/shared/tables.lua 79
lua/ULib/shared/util.lua 120
------------
3242

ULX:
Code: [Select]
lua/ULib/modules/ulx_init.lua 5
lua/ulx/base.lua 84
lua/ulx/cl_init.lua 22
lua/ulx/cl_lib.lua 193
lua/ulx/end.lua 53
lua/ulx/init.lua 42
lua/ulx/lib.lua 79
lua/ulx/log.lua 216
lua/ulx/modules/cl/adminmenu.lua 104
lua/ulx/modules/cl/banmenu.lua 211
lua/ulx/modules/cl/clientmenu.lua 50
lua/ulx/modules/cl/mainmenu.lua 35
lua/ulx/modules/cl/mapsmenu.lua 58
lua/ulx/modules/cl/motdmenu.lua 36
lua/ulx/modules/sh/chat.lua 226
lua/ulx/modules/sh/fun.lua 693
lua/ulx/modules/sh/menus.lua 206
lua/ulx/modules/sh/rcon.lua 77
lua/ulx/modules/sh/teleport.lua 201
lua/ulx/modules/sh/user.lua 200
lua/ulx/modules/sh/userhelp.lua 64
lua/ulx/modules/sh/util.lua 253
lua/ulx/modules/sh/vote.lua 295
lua/ulx/modules/slots.lua 72
lua/ulx/modules/votemap.lua 149
lua/ulx/sh_base.lua 223
lua/ulx/sh_defines.lua 9
------------
3856

Which makes 7098 total. Do remember that the first post was two years ago... and we've added a lot more features and fixes since then. :P

As a point of interest, ULX 0.8 (GM9), which had much the same features as the current ULX and ULib, and had a prop protector as well:
Code: [Select]

init/init.lua 10
init/ulx_init.lua 11
ulx/ulx_antispam.lua 118
ulx/ulx_base.lua 249
ulx/ulx_config.lua 5
ulx/ulx_defines.lua 15
ulx/ulx_end.lua 6
ulx/ulx_fun.lua 167
ulx/ulx_lib.lua 137
ulx/ulx_menus.lua 186
ulx/ulx_menu_base.lua 227
ulx/ulx_users.lua 0
ulx/ulx_util.lua 209
------------
1340
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Current code amount standings
« Reply #3 on: December 30, 2009, 12:14:26 am »
Good example - fun.lua - pre svn = 1292, current = 693
Though somewhat difficult to tell with other files now that modules are being split a bit more... fun.lua hasn't really changed much except for each function no longer needing duplication of parameter checking; that is, each function having to check if all the inputs are being typed in correctly. That's all being done by ULib's command system now.

I love it.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

  • Print