Forum

> > CS2D > Scripts > Attempt to access concatenate field '?'
Forums overviewCS2D overview Scripts overviewLog in to reply

English Attempt to access concatenate field '?'

3 replies
To the start Previous 1 Next To the start

old Attempt to access concatenate field '?'

DannyDeth
User Off Offline

Quote
I see this error is pointing to my code:
1
2
3
4
function set_plyrs()
	parse("setpos "..pp[0].." "..T_spot[x].." "..T_spot[y]) -- This is where it errors ?
	parse("setpos "..pp[1].." "..CT_spot[x].." "..CT_spot[y])
end
And
I cannot find anything wrong with it

EDIT: This '?' would also happen to be nil (?), so it must be one of the arrays, but I am sure they exists becasue I wrote just above it:
1
2
T_spot = { x="126", y="126" } -- in pixels! --
CT_spot = {x="384", y ="384" } -- in pixels! --

EDIT2: And pp is set where the set_plyrs() function is called:
1
2
3
4
5
6
7
8
addhook("startround","pick_first")
function pick_first()
	local T = player(0,"team1")
	local CT = player(0,"team2")
	pp[0]=T[math.random(0,#T)]
	pp[1]=CT[math.random(0,#CT)]
	set_plyrs()
end

old Re: Attempt to access concatenate field '?'

Lee
Moderator Off Offline

Quote
Lee has written
You need to use tbl.x and tbl.y to access string members.

{x = ...} is a syntax sugar for {["x"] = ...}

In order to index these string members, you will need to use either tbl.x or tbl["x"].
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview