Author Topic: Strange user object error in RC4  (Read 2217 times)

0 Members and 1 Guest are viewing this topic.

Offline bastya_elvtars

  • Forum God
  • ****
  • Posts: 3 725
  • Karma: +173/-7
  • The rock n' roll doctor
    • The FreshStuff3 Site
Strange user object error in RC4
« on: 03 February, 2008, 13:55:36 »
With the following code:
Code: Lua
  1. function UserConnected(user)
  2.   if  Core.GetUserValue(user, 12) then

I get:

bad argument #1 to 'GetUserValue' (table expected, got string)

Hungarista told me to make the script display the type of the user object. I did it, and performed a reconnect. I got:

[13:35:46] <TYPE> table
[13:35:47] <TYPE> table
[13:35:47] <TYPE> string


The modified code was:
Code: Lua
  1. function UserConnected(user)
  2.   Core.SendToAll("<TYPE> "..type(user).."|")
  3.   if  Core.GetUserValue(user, 12) then
Everything could have been anything else and it would have just as much meaning.

PtokaX forum

Strange user object error in RC4
« on: 03 February, 2008, 13:55:36 »

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Re: Strange user object error in RC4
« Reply #1 on: 03 February, 2008, 17:18:06 »
Tested on real users with
Code: [Select]
function UserConnected(user)
  Core.SendToNick("PPK", "<TYPE> "..type(user).."|")
end
result
Quote
[14:30:46] <TYPE> table
[14:32:04] <TYPE> table
[14:35:11] <TYPE> table
[14:35:27] <TYPE> table
[14:36:30] <TYPE> table
[14:37:16] <TYPE> table
[14:38:02] <TYPE> table
[14:38:53] <TYPE> table
[14:39:17] <TYPE> table
[14:39:49] <TYPE> table
[14:40:40] <TYPE> table
[14:41:04] <TYPE> table
[14:41:24] <TYPE> table
[14:41:57] <TYPE> table
[14:41:57] <TYPE> table
[14:42:03] <TYPE> table
[14:44:14] <TYPE> table
[14:44:21] <TYPE> table
[14:45:42] <TYPE> table
[14:45:59] <TYPE> table
[14:46:07] <TYPE> table
[14:46:47] <TYPE> table
[14:46:52] <TYPE> table
[14:48:00] <TYPE> table
[14:49:09] <TYPE> table
[14:49:23] <TYPE> table
[14:49:44] <TYPE> table
[14:50:09] <TYPE> table
[14:50:37] <TYPE> table
[14:52:26] <TYPE> table
[14:52:34] <TYPE> table
[14:53:04] <TYPE> table
[14:53:18] <TYPE> table
[14:54:13] <TYPE> table
[14:54:22] <TYPE> table
[14:55:17] <TYPE> table
[14:55:57] <TYPE> table
[14:56:04] <TYPE> table
[14:57:10] <TYPE> table
[14:57:27] <TYPE> table
[14:57:46] <TYPE> table
[14:57:51] <TYPE> table
[15:00:24] <TYPE> table
[15:01:20] <TYPE> table
[15:03:27] <TYPE> table
[15:04:09] <TYPE> table
[15:06:23] <TYPE> table
[15:06:32] <TYPE> table
[15:06:33] <TYPE> table
[15:07:38] <TYPE> table
[15:09:19] <TYPE> table
[15:10:57] <TYPE> table
[15:11:52] <TYPE> table
[15:12:18] <TYPE> table
[15:16:43] <TYPE> table
[15:17:26] <TYPE> table
[15:18:32] <TYPE> table
[15:18:53] <TYPE> table
[15:19:01] <TYPE> table
[15:19:35] <TYPE> table
[15:20:19] <TYPE> table
[15:20:36] <TYPE> table
[15:20:36] <TYPE> table
[15:21:39] <TYPE> table
[15:22:24] <TYPE> table
[15:22:47] <TYPE> table
[15:25:48] <TYPE> table
[15:25:56] <TYPE> table
[15:26:37] <TYPE> table
[15:27:36] <TYPE> table
[15:28:32] <TYPE> table
[15:28:57] <TYPE> table
[15:29:09] <TYPE> table
[15:31:41] <TYPE> table
[15:32:16] <TYPE> table
[15:33:42] <TYPE> table
[15:34:54] <TYPE> table
[15:35:23] <TYPE> table
[15:35:50] <TYPE> table
[15:36:20] <TYPE> table
[15:37:54] <TYPE> table
[15:38:35] <TYPE> table
[15:40:41] <TYPE> table
[15:40:55] <TYPE> table
[15:41:15] <TYPE> table
[15:42:35] <TYPE> table
[15:42:44] <TYPE> table
[15:45:06] <TYPE> table
[15:47:43] <TYPE> table
[15:47:53] <TYPE> table
[15:48:00] <TYPE> table
[15:48:46] <TYPE> table
[15:48:51] <TYPE> table
[15:49:20] <TYPE> table
[15:49:42] <TYPE> table
[15:50:29] <TYPE> table
[15:50:47] <TYPE> table
[15:52:21] <TYPE> table
[15:52:34] <TYPE> table
[15:52:47] <TYPE> table
[15:53:41] <TYPE> table
[15:55:53] <TYPE> table
[15:57:17] <TYPE> table
[15:57:33] <TYPE> table
[15:58:07] <TYPE> table
[15:58:39] <TYPE> table
[15:58:44] <TYPE> table
[15:59:33] <TYPE> table
[16:00:00] <TYPE> table
[16:01:33] <TYPE> table
[16:02:52] <TYPE> table
[16:03:36] <TYPE> table
[16:04:13] <TYPE> table
[16:04:26] <TYPE> table
[16:05:13] <TYPE> table
[16:06:15] <TYPE> table
[16:08:30] <TYPE> table
[16:10:15] <TYPE> table
[16:10:17] <TYPE> table
[16:11:55] <TYPE> table
[16:15:15] <TYPE> table
[16:16:37] <TYPE> table
[16:17:05] <TYPE> table
[16:17:34] <TYPE> table
[16:17:39] <TYPE> table
[16:18:56] <TYPE> table
[16:20:00] <TYPE> table
[16:22:51] <TYPE> table
[16:25:41] <TYPE> table
[16:26:26] <TYPE> table
[16:26:55] <TYPE> table
[16:28:40] <TYPE> table
[16:28:53] <TYPE> table
[16:29:49] <TYPE> table
[16:29:55] <TYPE> table
[16:30:03] <TYPE> table
[16:30:59] <TYPE> table
[16:32:02] <TYPE> table
[16:32:36] <TYPE> table
[16:33:14] <TYPE> table
[16:34:38] <TYPE> table
[16:37:47] <TYPE> table
[16:38:26] <TYPE> table
[16:38:44] <TYPE> table
[16:39:17] <TYPE> table
[16:39:37] <TYPE> table
[16:40:36] <TYPE> table
[16:43:15] <TYPE> table
[16:43:33] <TYPE> table
[16:43:33] <TYPE> table
[16:46:18] <TYPE> table
[16:46:23] <TYPE> table
[16:46:32] <TYPE> table
[16:46:50] <TYPE> table
[16:47:31] <TYPE> table
[16:49:13] <TYPE> table
[16:49:50] <TYPE> table
[16:51:49] <TYPE> table
[16:52:07] <TYPE> table
[16:52:55] <TYPE> table
[16:55:27] <TYPE> table
[16:56:43] <TYPE> table
[16:57:00] <TYPE> table
[17:00:14] <TYPE> table
[17:00:29] <TYPE> table
[17:00:40] <TYPE> table
[17:01:13] <TYPE> table
[17:02:04] <TYPE> table
[17:02:14] <TYPE> table
[17:02:58] <TYPE> table
[17:03:05] <TYPE> table
[17:03:41] <TYPE> table
[17:04:49] <TYPE> table
[17:06:46] <TYPE> table
[17:07:23] <TYPE> table
[17:08:02] <TYPE> table
[17:08:52] <TYPE> table
[17:10:49] <TYPE> table
[17:11:08] <TYPE> table
[17:11:21] <TYPE> table
[17:11:29] <TYPE> table
[17:11:30] <TYPE> table
[17:11:37] <TYPE> table
[17:11:42] <TYPE> table
[17:12:04] <TYPE> table
[17:12:17] <TYPE> table
[17:12:21] <TYPE> table
[17:12:58] <TYPE> table
[17:13:47] <TYPE> table
[17:14:32] <TYPE> table
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Offline amenay

  • Member
  • ***
  • Posts: 27
  • Karma: +10/-0
Re: Strange user object error in RC4
« Reply #2 on: 03 February, 2008, 19:57:57 »
Going with the simplest explanation first..Any chance you have a function defined elsewhere in the script calling UserConnected that you're overlooking? (:

Offline bastya_elvtars

  • Forum God
  • ****
  • Posts: 3 725
  • Karma: +173/-7
  • The rock n' roll doctor
    • The FreshStuff3 Site
Re: Strange user object error in RC4
« Reply #3 on: 03 February, 2008, 20:09:09 »
Yeah, that was the problem and it's been solved a few hours ago (would be too long to explain here), thanks anyway.
Everything could have been anything else and it would have just as much meaning.

PtokaX forum

Re: Strange user object error in RC4
« Reply #3 on: 03 February, 2008, 20:09:09 »