Skip to content

Global variable that wasn't used before is not referenced correctly when passed to function as parameter. #131

Closed
@Yiin

Description

@Yiin

Sample code:

#include <a_samp>

new foo = 1;

public OnFilterScriptInit() {
	test(foo);
}

test(var) {
	printf("%i", var); // 37
}

If I print something before calling test function, character code is passed instead:

#include <a_samp>

new foo = 1;

public OnFilterScriptInit() {
	printf("A");
	test(foo);
}

test(var) {
	printf("%i", var); // 65
}

and finally if I modify value of that global variable, everything works just fine:

#include <a_samp>

new foo = 1;

public OnFilterScriptInit() {
	foo++;
	test(foo);
}

test(var) {
	printf("%i", var); // 2
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions