Fixed bugreport:6446 credits to flaviojs, special thanks to Lelouch vi Britannia for the dump.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16638 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
shennetsind 2012-08-15 12:21:23 +00:00
parent e55279cabe
commit c30a8f75d0

View File

@ -13331,19 +13331,17 @@ BUILDIN_FUNC(charislower)
//======================================================= //=======================================================
// charat <str>, <index> // charat <str>, <index>
//------------------------------------------------------- //-------------------------------------------------------
BUILDIN_FUNC(charat) BUILDIN_FUNC(charat) {
{
const char *str = script_getstr(st,2); const char *str = script_getstr(st,2);
int pos = script_getnum(st,3); int pos = script_getnum(st,3);
char *output;
output = (char*)aMalloc(2*sizeof(char)); if( pos >= 0 && (unsigned int)pos < strlen(str) ) {
output[0] = '\0'; char output[2];
output[0] = str[pos];
if(str && pos >= 0 && (unsigned int)pos < strlen(str)) output[1] = '\0';
sprintf(output, "%c", str[pos]); script_pushstrcopy(st, output);
} else
script_pushstr(st, output); script_pushconststr(st, "");
return 0; return 0;
} }