Author Topic: Bug report: minor residual bug with RET_ARRAY  (Read 617 times)

Offline DavidW

  • Planewalker
  • *****
  • Posts: 316
Bug report: minor residual bug with RET_ARRAY
« on: July 06, 2021, 10:59:20 PM »
You were kind enough to permit empty arrays to be returned with RET_ARRAY, which is simplifying my code enormously.

There is, however, an edge case that still causes problems: if you return an empty array that you set equal to an array that isn't empty. Here's some code that reproduces it:
Code: [Select]

BEGIN "This throws an install-time-error" DESIGNATED 0

OUTER_SPRINT $array1(0) "minsc"

DEFINE_ACTION_FUNCTION fn
RET_ARRAY array2
BEGIN
END

LAF fn RET_ARRAY array1=array2 END

BEGIN "This doesn't" DESIGNATED 1

DEFINE_ACTION_FUNCTION fn
RET_ARRAY array2
BEGIN
END

LAF fn RET_ARRAY array1=array2 END

BEGIN "Nor does this" DESIGNATED 2

OUTER_SPRINT $array1(0) "minsc"

DEFINE_ACTION_FUNCTION fn
RET_ARRAY array2
BEGIN
OUTER_SET $array2("whocares")=1
END

LAF fn RET_ARRAY array1=array2 END

In the first block, fn returns an empty array 'array2', and it's then set to 'array1' in the function call. That returns 'unknown return value: array2_0'. It doesn't occur if I put something in array2 within the function, or if I set it to a new array in the function call. I assume this is unintentional.

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Re: Bug report: minor residual bug with RET_ARRAY
« Reply #1 on: July 22, 2021, 05:19:25 AM »
Will look into.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: