WeiDUorg / weidu

WeiDU is a program used to develop, distribute and install modifications for games based on the Infinity Engine.
http://www.weidu.org
GNU General Public License v2.0
90 stars 20 forks source link

Do not fail on empty return arrays #142

Closed FredrikLindgren closed 4 years ago

FredrikLindgren commented 5 years ago

http://forums.pocketplane.net/index.php/topic,29828.0.html

4Luke4 commented 4 years ago

@FredrikLindgren

Unless I'm missing something, ACTION_CLEAR_ARRAY "array" // or CLEAR_ARRAY "array" is a valid way to initialize an array. As a result, if you execute that command, you won't get the error message linked above.

FredrikLindgren commented 4 years ago

I cannot reproduce such behaviour with WeiDU 246 and there is nothing in the implementation of *CLEAR_ARRAY that suggests it would "initialise" an array. Regardless, as of whichever commit it was, WeiDU no longer fails on uninitialised return arrays.

4Luke4 commented 4 years ago

... and there is nothing in the implementation of *CLEAR_ARRAY that suggests it would "initialise" an array.

Yeah, sorry, you're right.

Anyway, you can reproduce this issue by launching this function

DEFINE_ACTION_FUNCTION test
RET_ARRAY
    foo
BEGIN
    ACTION_CLEAR_ARRAY "foo"
    ACTION_IF 0 BEGIN
        OUTER_SET $foo(1) = 90
    END
END