ULX

Author Topic: Lua Error - log.lua  (Read 6569 times)

0 Members and 1 Guest are viewing this topic.

Offline sabo

  • Full Member
  • ***
  • Posts: 136
  • Karma: 2
  • Hello :)
    • The Elite Gaming
Lua Error - log.lua
« on: September 20, 2013, 04:30:10 PM »
Hey guys.

Recently I have been getting this error in my server  web console. It does not spamm like , but it pops up rather often and it annoys me to be honest.

Code: [Select]
19:34:37 Lua Error: addons/ulx/lua/ulx/log.lua:440: attempt to index local 'format' (a nil value)
I do not know why or how this error gets created so I can only give you the information above for now.

I am really tired and it is 2 am here lol, so good night for now ;)

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Lua Error - log.lua
« Reply #1 on: September 20, 2013, 05:13:54 PM »
We would need the full stack trace to be of any help to you. I suspect this is caused by one of your third-party addons to ULX, though.
Experiencing God's grace one day at a time.

Offline sabo

  • Full Member
  • ***
  • Posts: 136
  • Karma: 2
  • Hello :)
    • The Elite Gaming
Re: Lua Error - log.lua
« Reply #2 on: September 21, 2013, 10:31:51 AM »
We would need the full stack trace to be of any help to you. I suspect this is caused by one of your third-party addons to ULX, though.

What do you mean by "full stack trace" ?

I checked FAQ but didnt see anything in the titles :o

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Lua Error - log.lua
« Reply #3 on: September 21, 2013, 11:16:07 AM »
In this example the ERROR would be:
Code: [Select]
[ERROR] gamemodes/sgstranded/gamemode/sv_exp.lua:10: attempt to index field 'exp' (a nil value)
The full stack trace for that error would be:
Code: [Select]
[ERROR] gamemodes/sgstranded/gamemode/sv_exp.lua:10: attempt to index field 'exp' (a nil value)
           1. GetTotalXP - gamemodes/sgstranded/gamemode/sv_exp.lua:10
            2. unknown - gamemodes/sgstranded/gamemode/sv_savesystem.lua:248

It allows us to see what is causing the error and where it is coming from.

For example: In my stack trace above we can see that line 248 in sv_savesystem.lua is calling GetTotalXP which is calling exp on line 10 of sv_exp.lua. This makes detecting/replicating/and debugging the error much easier than just having the error alone.
« Last Edit: September 21, 2013, 11:18:53 AM by MrPresident »

Offline sabo

  • Full Member
  • ***
  • Posts: 136
  • Karma: 2
  • Hello :)
    • The Elite Gaming
Re: Lua Error - log.lua
« Reply #4 on: September 21, 2013, 02:05:28 PM »
Ohh okay!

Well there is nothing additional to that 1 error but I found this one here:
Code: [Select]
17:10:08 Lua Error: [ERROR] addons/pointshopmaster/lua/sv_player_extension.lua:460: attempt to index global 'g_Player' (a nil value)
1. fn - addons/pointshopmaster/lua/sv_player_extension.lua:460
2. unknown - addons/ulib/lua/ulib/shared/hook.lua:183

This is line 459 - 466
Code: [Select]
function PS_ServerChangeMap()
for k, v in pairs( g_Player.GetAll() ) do
-- Save the player's data so that it doesn't reset next map.
v:PS_Save()
end;
end


hook.Add( "ShutDown", "PS_ServerChangeMap", PS_ServerChangeMap )

And this is the hook.lua:
Code: [Select]
function Call( name, gm, ... )
for i = 1, #resort do
sortHooks( resort[ i ] )
end
resort = {}

-- If called from hook.Run then gm will be nil.
if gm == nil and gmod ~= nil then
gm = gmod.GetGamemode()
end

local HookTable = Hooks[ name ]

if HookTable then
local a, b, c, d, e, f
for k=1, #HookTable do
v = HookTable[ k ]
if not v then
-- Nothing
else
-- Call hook function
if isstring( v.name ) then
a, b, c, d, e, f = v.fn( ... )       -- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::This is line 183
else
-- Assume it is an entity
if IsValid( v.name ) then
a, b, c, d, e, f = v.fn( v.name, ... )
else
table.insert( resort, name )
end
end

if a ~= nil then
-- Allow hooks to override return values if it's within the limits (-20 and 20 are read only)
if v.priority > -20 and v.priority < 20 then
return a, b, c, d, e, f
end
end
end
end
end

if not gm then return end

local GamemodeFunction = gm[ name ]
if not GamemodeFunction then
return
end

-- This calls the actual gamemode function - after all the hooks have had chance to override
return GamemodeFunction( gm, ... )
end
« Last Edit: September 21, 2013, 02:11:51 PM by sabo »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Lua Error - log.lua
« Reply #5 on: September 21, 2013, 07:29:09 PM »
We modify hook.lua, but the error is really due to sv_player_extension in this case.
Experiencing God's grace one day at a time.

Offline sabo

  • Full Member
  • ***
  • Posts: 136
  • Karma: 2
  • Hello :)
    • The Elite Gaming
Re: Lua Error - log.lua
« Reply #6 on: September 22, 2013, 07:44:55 AM »
We modify hook.lua, but the error is really due to sv_player_extension in this case.
Youre right, I just had to replace the "g_player" with "player" ^^ thx

Offline sabo

  • Full Member
  • ***
  • Posts: 136
  • Karma: 2
  • Hello :)
    • The Elite Gaming
Re: Lua Error - log.lua
« Reply #7 on: October 03, 2013, 10:45:17 AM »
Code: [Select]
10:03:41 Lua Error: [ERROR] addons/ulx/lua/ulx/log.lua:440: attempt to index local 'format' (a nil value)
1. fancyLogAdmin - addons/ulx/lua/ulx/log.lua:440
2. fancyLog - addons/ulx/lua/ulx/log.lua:504
3. call - addons/ulx/lua/ulx/modules/sh/chat.lua:35
4. __fn - addons/ulib/lua/ulib/shared/commands.lua:943
5. unknown - addons/ulib/lua/ulib/shared/commands.lua:1296
6. Run - lua/includes/modules/concommand.lua:69
7. unknown - addons/ulib/lua/ulib/shared/commands.lua:1310
8. unknown - lua/includes/modules/concommand.lua:69



10:04:17 Lua Error: [ERROR] addons/ulx/lua/ulx/log.lua:440: attempt to index local 'format' (a nil value)
1. fancyLogAdmin - addons/ulx/lua/ulx/log.lua:440
2. fancyLog - addons/ulx/lua/ulx/log.lua:504
3. call - addons/ulx/lua/ulx/modules/sh/chat.lua:35
4. __fn - addons/ulib/lua/ulib/shared/commands.lua:943
5. unknown - addons/ulib/lua/ulib/shared/commands.lua:1296
6. Run - lua/includes/modules/concommand.lua:69
7. unknown - addons/ulib/lua/ulib/shared/commands.lua:1310
8. unknown - lua/includes/modules/concommand.lua:69


10:04:25 Lua Error: addons/ulx/lua/ulx/log.lua:440: attempt to index local 'format' (a nil value)


10:04:40 Lua Error: addons/ulx/lua/ulx/log.lua:440: attempt to index local 'format' (a nil value)



I think I was getting excited too early O.o



I feel like it has alot to do with this, please compare my version I used and the version of Mr. President:

http://forums.ulyssesmod.net/index.php/topic,6657.msg32322.html#msg32322

thanks!
« Last Edit: October 03, 2013, 10:50:10 AM by sabo »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Lua Error - log.lua
« Reply #8 on: October 04, 2013, 10:13:11 AM »
You're not defining format anywhere.
Experiencing God's grace one day at a time.

Offline sabo

  • Full Member
  • ***
  • Posts: 136
  • Karma: 2
  • Hello :)
    • The Elite Gaming
Re: Lua Error - log.lua
« Reply #9 on: October 05, 2013, 03:05:54 PM »
Code: [Select]
18:14:27 Lua Error: addons/ulx/lua/ulx/log.lua:440: attempt to index local 'format' (a nil value)
I have been searching through my console/logs to find anything but that is the only that gets spammed like crazy :(

Should I try using the normal ULX version instead of the SVN?

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Lua Error - log.lua
« Reply #10 on: October 05, 2013, 03:39:38 PM »
No... this error is coming from the code you modified, not any of the default ULX code.
Experiencing God's grace one day at a time.

Offline sabo

  • Full Member
  • ***
  • Posts: 136
  • Karma: 2
  • Hello :)
    • The Elite Gaming
Re: Lua Error - log.lua
« Reply #11 on: October 07, 2013, 01:08:25 PM »
I just got this little sweetie here:

Code: [Select]
[ERROR] addons/ulx/lua/ulx/modules/sh/chat.lua:25: attempt to call method 'Team' (a nil value)
1. call - addons/ulx/lua/ulx/modules/sh/chat.lua:25
2. __fn - addons/ulib/lua/ulib/shared/commands.lua:943
3. unknown - addons/ulib/lua/ulib/shared/commands.lua:1296
4. unknown - lua/includes/modules/concommand.lua:69


It is 100% the admin chat tho.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Lua Error - log.lua
« Reply #12 on: October 07, 2013, 04:52:38 PM »
Sabo, this is not coming from our chat.lua. Line 25 is [[format = "#P to admins: #s"]]. I suggest reverting back to default code.
Experiencing God's grace one day at a time.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Lua Error - log.lua
« Reply #13 on: October 07, 2013, 07:47:56 PM »
This is from the modified ulx.asay code I posted in another thread.

I never intended for the code to be run by console and since the isn't a player and has no team, it's throwing this error.

I'm working with him to fix it.

Offline sabo

  • Full Member
  • ***
  • Posts: 136
  • Karma: 2
  • Hello :)
    • The Elite Gaming
Re: Lua Error - log.lua
« Reply #14 on: October 08, 2013, 11:04:54 AM »
So far Mr. President made this:

Code: [Select]
    ------------------------------ Asay ------------------------------
    local seeasayAccess = "ulx seeasay"
    if SERVER then ULib.ucl.registerAccess( seeasayAccess, ULib.ACCESS_OPERATOR, "Ability to see 'ulx asay'", "Other" ) end -- Give operators access to see asays echoes by default
     
    function ulx.asay( calling_ply, message )
     print(calling_ply)

            local players = player.GetAll()
           
            if calling_ply then
                    for i=#players, 1, -1 do
                            local v = players[ i ]
                            if ULib.ucl.query( v, seeasayAccess ) and v ~= calling_ply then
                                    if ULib.ucl.query( calling_ply, seeasayAccess ) then
                                            ULib.tsayColor(v, 1, Color(65,105,225), "::Admin:: ", team.GetColor(calling_ply:Team()), calling_ply:Nick(), Color(112,138,144), ": ", message )    ----------- This is line 30
                                    else
                                            ULib.tsayColor(v, 1, Color(0,0,0), "::User:: ", team.GetColor(calling_ply:Team()), calling_ply:Nick(), Color(119,136,153), ": ", message )
                                    end
                            end
                            if v == calling_ply then
                                    ULib.tsayColor(v, 1, Color(49,79,79), "::To Admins:: ", team.GetColor(calling_ply:Team()), calling_ply:Nick(), Color(112,138,144), ": ", message )
                            end
                    end
     
                    local logFile = ulx.convar( "logFile", "1", "Log to file (Can still echo if off). This is a global setting, nothing will be logged to file with this off.", ULib.ACCESS_SUPERADMIN )
                    if logFile:GetBool() then
                            ulx.logString( calling_ply:Nick() .. " to admins: " .. message, true )
                    end
            else
                    for i=#players, 1, -1 do
                            local v = players[ i ]
                            ULib.tsayColor(v, 1, Color(80,80,80), "::Console to admins:: ", Color(112,138,144), ": ", message )
                    end
     
                    local logFile = ulx.convar( "logFile", "1", "Log to file (Can still echo if off). This is a global setting, nothing will be logged to file with this off.", ULib.ACCESS_SUPERADMIN )
                    if logFile:GetBool() then
                            ulx.logString( "Console to admins: " .. message, true )
                    end
            end
     
    end
    local asay = ulx.command( CATEGORY_NAME, "ulx asay", ulx.asay, "@", true, true )
    asay:addParam{ type=ULib.cmds.StringArg, hint="message", ULib.cmds.takeRestOfLine }
    asay:defaultAccess( ULib.ACCESS_ALL )
    asay:help( "Send a message to currently connected admins." )

And this is the error I am getting:

Code: [Select]
[NULL Entity]
L 10/08/2013 - 14:16:38: Lua Error:
[ERROR] addons/ulx/lua/ulx/modules/sh/chat.lua:30: attempt to call method 'Team' (a nil value)
1. call - addons/ulx/lua/ulx/modules/sh/chat.lua:30
2. __fn - addons/ulib/lua/ulib/shared/commands.lua:943
3. unknown - addons/ulib/lua/ulib/shared/commands.lua:1296
4. unknown - lua/includes/modules/concommand.lua:69