Forum

> > CS2D > Scripts > Lua error
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua error

5 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Lua error

Q-Q
User Off Offline

Zitieren
I learned this piece of code from a lua toturial:

1
2
3
4
5
6
7
8
9
addhook("minute","Test")
function test()
for(i=1,32,2)do
if (player(i,"exists"))then
msg2(i,"This is advertising")
end
end
end
end

But strangeley enough it gives me this error:
LUA ERROR: sys/lua/test.lua:3: '<name>' expected near '('

what is wrong?

alt Re: Lua error

Starkkz
Moderator Off Offline

Zitieren
I think you added an extra "end", btw this is easier:

1
2
3
4
addhook("minute","Test")
function Test()
	msg("This is advertising")
end

Note: test is not the same as Test, there are difference of the capital letters.

alt Re: Lua error

SilentDash
User Off Offline

Zitieren
try this
1
2
3
4
5
6
7
addhook("minute","test")
	function test()
		for(i=1,32,2)do
		if (player(i,"exists"))then
		msg2(i,"This is advertising")
	end
end

alt Re: Lua error

Yates
Reviewer Off Offline

Zitieren
user palomino hat geschrieben
Too many ends.

MOAR ENDS!

---

You only need 3 ends.
1
2
addhook("minute","Test")
function test()
Capital letter T and small letter t? Won't work.

Why are you checking if the player exists? And why the for i, .. stuff?

Wait, how did you make that "magic wizards" Lua? I fuckin' lol'd.

Edit: You guys posted faster than me
2× editiert, zuletzt 28.10.11 19:16:11
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht