English error in lua

8 replies
Goto Page
To the start Previous 1 Next To the start
22.03.12 09:54:47 pm
Up
Jhony
User
Offline Off
what my error
i created one menu
Code:
1
menu(id,""..player(pl,"name")..","..player(pl,"name").."")


ERROR :
Code:
1
LUA ERROR: sys/lua/impos.lua:36: bad argument #1 to 'player' (number expected, got nil)


help pls
sorry inglish
22.03.12 09:57:16 pm
Up
Bowlinghead
User
Offline Off
Have you got the right parameter?
Quote:
player(pl,"name")
Share time limited free games here
22.03.12 10:26:27 pm
Up
VADemon
User
Offline Off
Code:
1
menu(id,""..player(id,"name")..","..player(id,"name").."")


Why so?

I will describe it in an example:
You sends a letter (function) to your friend with a number in it (id). In his language id is pl
So, we call a function: menu(id) but the friend receives it and for him it's so: menu(pl). The only local variable in this function he can use is pl. That's why you have to look which variable names you have in this function.

Well I hope I didn't many mistakes (english) and you understood that.

WRONG:
Code:
1
2
3
function msg(id)
msg("The ID is:"..pl)
end


RIGHT:
Code:
1
2
3
function msg(pl)
msg("The ID is:"..pl)
end


ALSO RIGHT:
Code:
1
2
3
function msg(num,id)
msg("The ID is:"..id.." And the number is:"..num)
end
23.03.12 12:03:21 am
Up
Jhony
User
Offline Off
look

Code:
1
LUA ERROR: sys/lua/impos.lua:52: bad argument #1 to 'player' (number expected, got nil)


and

Code:
1
2
addhook("menu","action2")
function action2(id,tittle,button,pl)


and
Error in line 52 :

Code:
1
menu(id,"USGN,"..player(pl,"name")..","..player(pl,"name")..","..player(pl,"name")..","..player(pl,"name")..","..player(pl,"name")..","..player(pl,"name")..","..player(pl,"name")..","..player(pl,"name").."")



help me urgent
23.03.12 05:57:19 am
Up
miere
User
Offline Off
there is no 4th parameter in menu hook.
http://cs2d.com/help.php?hookcat=all&hook=menu#hook
23.03.12 03:36:15 pm
Up
Yates
Reviewer
Offline Off
@user Jhony: pl = id, remove it from the function and replace all pl with id.
23.03.12 04:31:15 pm
Up
Jhony
User
Offline Off
user Yates has written:
@user Jhony: pl = id, remove it from the function and replace all pl with id.


not
I do not want to change the ID function
only want the "pl" is to choose the player
23.03.12 11:00:21 pm
Up
Yates
Reviewer
Offline Off
Since pl won't work you are either forced to make it work with a function, but that would be changing id into pl which is a waste of time or listen to me and change it. It's not like the world will fall apart because of this. I'm trying to help, in fact.
23.03.12 11:32:48 pm
Up
Bowlinghead
User
Offline Off
Just change the parameter "id" to "pl".

Code:
1
2
addhook("menu","action2")
function action2(pl,tittle,button)


And the code is right!
Share time limited free games here
To the start Previous 1 Next To the start