Originally posted by [b]Ai4rei[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=1701
The script engine only checks correct argument count (done in parse_callfunc; script.c), not their type (i, s, l, r), thus any BUILDIN_DEF line is like everywhere would be just v, * and ?. The problem is, many commands rely on the missing check, and may crash the server without any message, e.g.
getmapxy.
Considering following dummy command:
CODE
BUILDIN_FUNC(dummy)
{
const char* param_str = script_getstr(st,2);
int param_int = script_getnum(st,3);
ShowDebug("buildin_dummy: STR: %s, INT: %d\n", param_str, param_int);
return 0;
}
[...]
BUILDIN_DEF(dummy,"si"),
Will still allow to call it with:
CODE
set .str$,"abc";
set .num,123;
dummy .str$,.num; // OK
dummy "abc",11; // OK
dummy .num,.str$; // Should fail
dummy 11,"abc"; // Should fail
Currently is just prints (tested as debug and release with r128xx):
CODE
[Debug]: buildin_dummy: STR: abc, INT: 123
[Debug]: buildin_dummy: STR: abc, INT: 11
[Debug]: buildin_dummy: STR: 123, INT: 0
[Debug]: buildin_dummy: STR: 11, INT: 0