ModApp Accept command? ulx ttt

Hello, I was having some problems with my code here, and was wondering if you lovely people at Facepunch could help. Thanks in advance!


local CATEGORY_NAME = "Utility"

function ulx.modapp( calling_ply, target_plys )

    local affected_plys = {}
    
    for i=1, #target_plys do
		local v = calling_ply[ i ]
            if not should_modapp then
                v:SendLua([[RunConsoleCommand("ulx tsay Congratulations #T! You're mod app has been approved!")]])
                v:SendLua([[RunConsoleCommand("ulx adduser #T mod")]])
            end
    end
    
    if not should_modapp then
        ulx.fancyLogAdmin( calling_ply, "#A has accepted #T's mod app.", target_plys )
    end
end

local tttmodapp = ulx.command( CATEGORY_NAME, "ulx mod", ulx.modapp, "!mod" )
tttmodapp:addParam{ type=ULib.cmds.PlayersArg }
tttmodapp:addParam{ type=ULib.cmds.BoolArg, invisible=true }
tttmodapp:defaultAccess( ULib.ACCESS_SUPERADMIN )
tttmodapp:help( "Makes a player moderator." )

EDIT:
My error:


[ERROR] lua/autorun/server/modapp.lua:10: attempt to index local 'v' (a nil value)
1. call - lua/autorun/server/modapp.lua:10
2. __fn - addons/ulib/lua/ulib/shared/commands.lua:943
3. unknown - addons/ulib/lua/ulib/shared/commands.lua:1296
4. Run - lua/includes/modules/concommand.lua:69
5. unknown - addons/ulib/lua/ulib/shared/commands.lua:1310
6. unknown - lua/includes/modules/concommand.lua:69


local CATEGORY_NAME = "Utility"

function ulx.modapp( calling_ply, target_plys )

    local affected_plys = {}
    
    for i=1, #target_plys do
		local v = target_plys[ i ]
		
		if not should_modapp then
			v:ChatPrint("Congratulations " .. v:Nick() .. "! Your mod app has been approved!")
			calling_ply:ConCommand("ulx adduser " .. v:Nick() .. " mod")
		end
    end
    
    if not should_modapp then
        ulx.fancyLogAdmin( calling_ply, "#A has accepted #T's mod app.", target_plys )
    end
end

local tttmodapp = ulx.command( CATEGORY_NAME, "ulx mod", ulx.modapp, "!mod" )
tttmodapp:addParam{ type=ULib.cmds.PlayersArg }
tttmodapp:addParam{ type=ULib.cmds.BoolArg, invisible=true }
tttmodapp:defaultAccess( ULib.ACCESS_SUPERADMIN )
tttmodapp:help( "Makes a player moderator." )

Thanks Derek! Works perfectly!