ZScript: self used outside of member function (const array)

Tue Nov 06, 2018 6:36 am

Discovered while looking at the code in this post, but here is a simpler example. The following ZScript will make GZDoom produce an error message:

Code:
class TestClass
{
    static const int ConstArray[] = { 1 };
   
    static int Test()   
    {
        return ConstArray[0];
    }
}

Code:
Script error, "zscript.txt:ZSCRIPT" line 7:
self used outside of a member function

This can be fixed by changing "return ConstArray[0]" to "return TestClass.ConstArray[0]". However, since ConstArray is declared as static, and the function is contained within the same class where ConstArray is declared, this shouldn't be needed.

Tested in GZDoom 3.6.0, g3.7pre-182-gb1d35eb0b
You do not have the required permissions to view the files attached to this post.