• Print

Author Topic: What does this error mean?  (Read 5676 times)

0 Members and 1 Guest are viewing this topic.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
What does this error mean?
« on: September 06, 2016, 02:27:06 pm »
Code: Lua
  1. local admins = {}
  2.  
  3.  
  4. function ulx.respond( calling_ply, target_ply, message )
  5.  
  6.  
  7.    for k,v in pairs( player.GetAll() ) do
  8.      
  9.       if v:CheckGroup( "operator" ) then -- This will add all "operator"s, and higher (anything that inherits, change if you want).
  10.          
  11.          table.insert( admins, v )
  12.  
  13.  
  14.       end
  15.  
  16.  
  17.    end
  18.    ulx.fancyLog( { target_ply, calling_ply, admins }, "Admins to #P: " .. message, target_ply )
  19.  
  20.  
  21. end
  22. local respond = ulx.command( "Chat", "ulx respond", ulx.respond, "#", true )
  23. respond:addParam{ ULib.cmds.PlayerArg, target="!^", ULib.cmds.ignoreCanTarget }
  24. respond:addParam{ ULib.cmds.StringArg, hint="message", ULib.cmds.takeRestOfLine }
  25. respond:defaultAccess( ULib.ACCESS_OPERATOR ) -- Make sure if you change the admins in the group, you change this (unless you want operators to see messages, but not send them).
  26. respond:help( "Sends a reply to someone from the Admins")
  27.  
  28.  
  29. function ulx.liststaff( calling_ply ) -- I have this in just because I was bored. Use it if you want.
  30.  
  31.  
  32.    for k,v in pairs( player.GetAll() ) do
  33.      
  34.       if v:CheckGroup( "operator" ) then
  35.          
  36.          table.insert( admins, string.upper( "(" .. v:GetUserGroup() .. ") " .. v:Nick() ) )
  37.  
  38.  
  39.       end
  40.  
  41.  
  42.    end
  43.    local cadmins = table.concat( admins, ", " )
  44.    ulx.fancyLog( { calling_ply }, "Currently connected staff: #s", cadmins )
  45.  
  46.  
  47. end
  48. local liststaff = ulx.command( "Utility", "ulx admins", ulx.liststaff, "!admins" )
  49. liststaff:defaultAccess( ULib.ACCESS_ALL )
  50. liststaff:help( "Displays a list of all connected admins." )
  51.  
  52.  
this is the script I'm using, pretty self explanatory (and simple), and this is the error I get when using respond:


Code: [Select]
] ulx respond


[ERROR] addons/ulib/lua/ulib/shared/commands.lua:890: attempt to index field 'type' (a nil value)
  1. __fn - addons/ulib/lua/ulib/shared/commands.lua:890
   2. unknown - addons/ulib/lua/ulib/shared/commands.lua:1296
    3. unknown - lua/includes/modules/concommand.lua:54


Now, even if I try just doing "ulx respond " with a space in the console, I get
Code: [Select]


[ERROR] addons/ulib/lua/ulib/shared/commands.lua:985: attempt to index field 'type' (a nil value)
  1. unknown - addons/ulib/lua/ulib/shared/commands.lua:985


Liststaff works properly, I'm just having trouble with respond. What do I need to change?
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: What does this error mean?
« Reply #1 on: September 06, 2016, 03:29:16 pm »
The big boys are viewing this threads, and have more experience then me, so maybe will be able to find the issue. Though, I recommend you tell everyone what line 890 and 985 are according to your current code.

Though my guess is fancylog or something.
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: What does this error mean?
« Reply #2 on: September 06, 2016, 03:32:29 pm »
The big boys are viewing this threads, and have more experience then me, so maybe will be able to find the issue. Though, I recommend you tell everyone what line 890 and 985 are according to your current code.

Though my guess is fancylog or something.
The entire thing there is my script. The errors are happening in a different file due to this, though.

Also, good to see you back.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: What does this error mean?
« Reply #3 on: September 06, 2016, 04:15:41 pm »
Note: it may be good to point out I'm on the prerelease version if Garry's Mod, don't know if it's necessary to state that, but I am.

« Last Edit: September 06, 2016, 04:29:42 pm by iViscosity »
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: What does this error mean?
« Reply #4 on: September 06, 2016, 04:42:39 pm »
I ended up just using the respond from here, but I'd still like why it wasn't working, as this was making me really angry...


Omg I figured it out...

Code: Lua
  1. respond:addParam{ ULib.cmds.PlayerArg, target="!^", ULib.cmds.ignoreCanTarget }
  2. respond:addParam{ ULib.cmds.StringArg, hint="message", ULib.cmds.takeRestOfLine }

I forgot type=...
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: What does this error mean?
« Reply #5 on: September 06, 2016, 04:43:19 pm »
You're missing the key type for your parameter type. It should be blah:addParam{ type=ULib.cmds.SomethingArg, ... }.
bw81@ulysses-forums ~ % whoami
Homepage

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: What does this error mean?
« Reply #6 on: September 06, 2016, 04:44:17 pm »
You're missing the key type for your parameter type. It should be blah:addParam{ type=ULib.cmds.SomethingArg, ... }.

Just as I said it :(
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: What does this error mean?
« Reply #7 on: September 06, 2016, 04:45:27 pm »
Just as I said it :(
I was working on the reply as you replied.
Hey, we all make small mistakes, man. Believe me.
bw81@ulysses-forums ~ % whoami
Homepage

Offline roastchicken

  • Respected Community Member
  • Sr. Member
  • *****
  • Posts: 476
  • Karma: 84
  • I write code
Re: What does this error mean?
« Reply #8 on: September 06, 2016, 07:11:36 pm »
I was working on the reply as you replied.
Hey, we all make small mistakes, man. Believe me.

I was absolutely baffled a few days ago as to why my timer wasn't working. I was about to wipe the server and do a fresh install when I tried joining and voila it worked. Sometimes you forget the simplest things...
Give a man some code and you help him for a day; teach a man to code and you help him for a lifetime.

  • Print