• Print

Author Topic: Random ULib error  (Read 4354 times)

0 Members and 1 Guest are viewing this topic.

Offline TheHyperDrive

  • Newbie
  • *
  • Posts: 15
  • Karma: 1
Random ULib error
« on: May 29, 2014, 12:22:30 am »
Alright so all of a sudden, I started getting this error in console:
Code: Lua
  1. ULib queue error: addons/ulib/lua/ulib/shared/messages.lua:80: attempt to get length of local 'arg' (a userdata value)
This is the line it refers to:
Code: Lua
  1. local current_chunk = { size = 0 }
  2.         local chunks = { current_chunk }
  3.         local max_chunk_size = 240
  4.         while #args > 0 do
  5.                 local arg = table.remove( args, 1 )
  6.                 local typ = type( arg )
  7.                 local arg_size = typ == "table" and 4 or #arg + 2 -- Include null in strings, bool in both
  8.                 if typ == "string" and current_chunk.size + arg_size > max_chunk_size then -- Split a large string up into multiple messages
  9.                         local substr = arg:sub( 1, math.max( 1, max_chunk_size - current_chunk.size - 2 ) )
  10.                         if #substr > 0 then
  11.                                 table.insert( current_chunk, substr )
  12.                         end
  13.                         table.insert( args, 1, arg:sub( #substr + 1) )
  14.  
  15.                         current_chunk = { size = 0 }
  16.                         table.insert( chunks, current_chunk )
  17.                 else
  18.                         if current_chunk.size + arg_size > max_chunk_size then
  19.                                 current_chunk = { size = 0 }
  20.                                 table.insert( chunks, current_chunk )
  21.                         end
  22.                         current_chunk.size = current_chunk.size + arg_size
  23.                         table.insert( current_chunk, arg )
  24.                 end
  25.         end

Line 80 is on line 7 here.

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Random ULib error
« Reply #1 on: May 29, 2014, 09:23:23 am »
Just a guess- it looks like something invalid is being passed to TSay. If this error is happening at regular intervals, perhaps you have an advert that is configured or formatted incorrectly? Share your adverts.txt file in your server's data/ulib or data/ulx (can't remember which), and we can see if anything looks amiss there.
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline TheHyperDrive

  • Newbie
  • *
  • Posts: 15
  • Karma: 1
Re: Random ULib error
« Reply #2 on: May 29, 2014, 11:33:29 am »
Actually it happens whenever I use my ulx.stuck command. It works fine, and doesn't cause any problems but this error pops up, and I just wanted to know what it was. Here's my "!stuck" command:
Code: Lua
  1. function ulx.stuck( calling_ply )
  2.         if not calling_ply:Alive() then
  3.         ULib.tsayColor(calling_ply, _, Color(255, 0, 0), "You can't do that!")
  4.         else
  5.         local pos = calling_ply:GetPos()
  6.         ULib.tsayColor(calling_ply, true, calling_ply, "You will be respawned in 5 seconds. DONT MOVE YOUR MOUSE OR TRY TO WALK!")
  7.         timer.Simple(5, function()
  8.                 if IsValid( calling_ply ) then
  9.                         if calling_ply:GetPos() == pos then
  10.                         calling_ply:Spawn()
  11.                         calling_ply:SetHealth( 50 )
  12.                         calling_ply:StripWeapon("weapon_smg1")
  13.                         calling_ply:Give("weapon_ar2")
  14.                         calling_ply:GiveAmmo(250, "ar2")
  15.                         ULib.tsayColor( _, Color(255, 60, 60, 255), calling_ply:Nick(), Color(0, 0, 255), " has been unstuck!:")
  16.                         else
  17.                         ULib.tsayColor(calling_ply, _, Color(255, 127, 0), "You moved during respawn cool down. Respawning aborted.")
  18.                         end
  19.                 end
  20.         end)
  21.         end
  22. end
  23. local stuck = ulx.command( "Prophunt", "ulx stuck", ulx.stuck, "!stuck" )
  24. stuck:defaultAccess( ULib.ACCESS_ALL )
  25. stuck:help( "Respawns you after 5 seconds if you're stuck" )

The only thing that malfunctions is on line 6, it does not print the phrase "You will be respawned....".
Also here is my Adverts.txt:

; ATTENTION! /ADDONS/ulx/data/ulx/<this file> is a DEFAULT file. DO NOT EDIT THE /ADDONS/ULX/DATA/ULX FOLDER FILE!!!
; Instead, edit the version in <garrysmod root>/data/ulx/ if it exists. If it doesn't, copy this file to <gmod root>/data/ulx/ to create it.
; Here's where you put advertisements
;
; Whether an advertisement is a center advertisement (csay) or text box advertisement (tsay) is determined by
; whether or not the "time_on_screen" key is present. If it is present, it's a csay.
;
; The 'time' argument inside a center advertisement and the number following a chat advertisement are the
; time it takes between each showing of this advertisement in seconds. Set it to 300 and the advertisement
; will show every five minutes.
;
; If you want to make it so that one advertisement is shown and then will always be followed by another,
; put them in a table. For example, if you add the following to the bottom of the file, A will always show
; first followed by B.
; "my_group"
; {
;     {
;         "text" "Advertisement A"
;         "time" "200"
;     }
;     {
;         "text" "Advertisement B"
;         "time" "300"
;     }
; }

{
   "text" "You're playing on %host%, enjoy your stay!"
   "red" "100"
   "green" "255"
   "blue" "200"
   "time_on_screen" "10"
   "time" "300"
}
{
   "text" "This server is running ULX Admin Mod version %ulx_version% by Team Ulysses -- ulyssesmod.net"
   "time" "635"
}
« Last Edit: May 29, 2014, 11:36:39 am by TheHyperDrive »

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Random ULib error
« Reply #3 on: May 29, 2014, 11:55:23 am »
The second "calling_ply" isn't required for ULib.tsayColor. Remove that so it looks like this:
Code: Lua
  1. ULib.tsayColor( calling_ply, true, Color( 255, 0, 0 ), "You will be respawned in 5 seconds. DONT MOVE YOUR MOUSE OR TRY TO WALK!" )
  2.  

You also lacked to define a color in your ULib.tsayColor. You can remove what I added and use just "ULib.tsay" instead or change it to a different RGB code. It's currently red.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline TheHyperDrive

  • Newbie
  • *
  • Posts: 15
  • Karma: 1
Re: Random ULib error
« Reply #4 on: May 29, 2014, 01:06:59 pm »
Ah okay, I see it now. I should have seen that before.  :-\ Thanks for the help!

  • Print