Error 079!
#2

Quote:
Originally Posted by bgedition
Посмотреть сообщение
Hello!
It's been long time since I used to code in pawn and I've forgotten things. I searched throughout G00gle and I've found nothing on my issue. So I have compiler error 079: inconsistent return types (array & non-array). Now I know that the function 'ParseFile' is returning something else than a string, but I cannot find it.
Код:
Locale(Code[]) {
    return ParseFile(LocaleFile, Code, PARSE_KEYS, true);
}

ParseFile(File:File, Search[], Type = PARSE_KEYS, bool:IgnoreCase = false, Delimiter[] = "=") {
    new Line[2048 + 3], Key[1024], Value[1024], Format[24];
    format(Format, sizeof(Format), "p<%s>s[%i]s[%i]", Delimiter, 1024, 1024);
    while(fread(File, Line)) {
        if(!sscanf(Line, Format, Key, Value)) {
            strtrim(Key); strtrim(Value);
            if(!strcmp(Type == PARSE_KEYS ? Key : Value, Search, IgnoreCase)) {
                Line = Type == PARSE_KEYS ? Value : Key;
                break;
            }
        }
    }
    //TODO: Fix error 079
    return Line;
}
Michael.
You forgot one bracket!

heres the fix

PHP код:
Locale(Code[]) {
    return 
ParseFile(LocaleFileCodePARSE_KEYStrue);
}
ParseFile(File:FileSearch[], Type PARSE_KEYSbool:IgnoreCase falseDelimiter[] = "=") {
    new 
Line[2048 3], Key[1024], Value[1024], Format[24];
    
format(Formatsizeof(Format), "p<%s>s[%i]s[%i]"Delimiter10241024);
    while(
fread(FileLine)) {
        if(!
sscanf(LineFormatKeyValue)) {
            
strtrim(Key); strtrim(Value);
            if(!
strcmp(Type == PARSE_KEYS Key ValueSearchIgnoreCase)) {
                
Line Type == PARSE_KEYS Value Key;
                break;
            }
        }
    }
    }
    return 
Line;

Reply


Messages In This Thread
[SOLVED]: Error 079! - by bgedition - 24.08.2018, 18:15
Re: Error 079! - by Lokii - 24.08.2018, 18:22
Re: Error 079! - by bgedition - 24.08.2018, 18:28
Re: Error 079! - by Spmn - 24.08.2018, 18:46
Re: Error 079! - by bgedition - 24.08.2018, 19:01

Forum Jump:


Users browsing this thread: 1 Guest(s)