1. Too Many/Less ends
Example:
1
2
3
4
5
6
2
3
4
5
6
addhook("say","foo") function foo(bar,baz) if baz=="Hello World!" then msg2(bar,"Hello World!") return 1 end
1
2
3
4
5
6
7
2
3
4
5
6
7
addhook("say","foo") function foo(bar,baz) 	if baz=="Hello World!" then 		msg2(bar,"Hello World!") 		return 1 	end end	-- this is it
Error Message(too many ends): LUA ERROR: filename:line number: '<eof>' expected near 'end'
2. Different file encoding.
Note, CS2D only able to handle ANSI encoded file corrently. UTF-8 w/o BOM threats some symbol to another symbol(example copyright sign into Â). UTF-8 and UTF-16(both LE & BE)simply throws LUA ERROR.
Solution: Change file encoding to ANSI. It doesn't necessary to encode file not in ANSI
Please not that all error message below always points to line 1
Error Message(UTF-8): LUA ERROR: filename:1: unexpected symbol near 'ï'
Error Message(UTF-16 LE): LUA ERROR: filename:1: unexpected symbol near 'ÿ'
Error Message(UTF-16 BE): LUA ERROR: filename:1: unexpected symbol near 'þ'
3. Return 1 doesn't work a.k.a conflicting hooks
Causes: there's more than 1 function using hooks that acept return values
Solution: By adding priority number as third argument in addhook(read carefully) or combine the function into 1.
Info: Hooks that accept return values: bombdefuse, bombexplode, bombplant, build, buildattempt, buy, die, dominate, drop, flagcapture, flagtake, hit, hitzone, log, name, objectdamage, objectupgrade, parse, radio, rcon, say, sayteam, spawn, team, trigger, triggerentity, and walkover
If you want to add more, feel free to comment
edited 1×, last 12.06.14 12:05:47 pm