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

Is there something that doesn't work right in the latest GZDoom? Post about it here.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!

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

Postby Player701 » Tue Nov 06, 2018 7: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: Select allExpand view
class TestClass
    static const int ConstArray[] = { 1 };
    static int Test()   
        return ConstArray[0];

Code: Select allExpand view
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
(145 Bytes) Downloaded 19 times
User avatar
You are now breathing manually.
Joined: 13 May 2009
Location: Russian Federation
Discord: Player701#8214

Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest