Forum

> > CS2D > Scripts > Function in table
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Function in table

2 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Function in table

xSkyLordx
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
gg={}
gg[1]={x=1,y=3,msg="menu open!",
func(id) menu(id,"Admin menu,commands,items,ban,kick") end
}

addhook("movetile","ggwalk")
function ggwalk(id,x,y)
for _,v in ipairs(gg) do
if (x==v.x) and (y==v.y) then

--Function of gg[1] ???

end
end
end

how can i use table func(id) function ??

alt Re: Function in table

EP
User Off Offline

Zitieren
This is the way you shall use:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
gg={}
gg[1]={x=1,
	y=3,
	msg="menu open!",
	func = function(id) menu(id,"Admin menu,commands,items,ban,kick") end}

addhook("movetile","ggwalk")
function ggwalk(id,x,y)
	for _,v in ipairs(gg) do
		if (x==v.x) and (y==v.y) then
			v.func(id)
		end
	end
end
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht