Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

(move: $x's 1st into $y) doesn't work?

Hello!

Learning Harlowe Twine 2 from http://twine2.neocities.org/, and there is instruction about (move:) macro, which could be very useful for me.

"(move:): This macro behaves like (put:), but it requires both sides of the into expression to be variables, and deletes the left side after copying its value to the right side. In other words, running (move: $x into $y) will change $y to $x's value and delete $x. Its main intended use is with arrays: (move: $x's 1st into $y) will remove the item at index 0 from the array and set $y to it"

But! It doesn't work. Here is my script:

(set: $ar to (a: 1,4,5))
(move: $ar's 1st into $trash)
$ar

and here is an error: http://prntscr.com/7saht2
("You can only use positions ('4th', 'last', '2nd-last', etc.) and 'length' with a an array.")

What am I doing wrong?

P.S. Sorry for my english

Comments

  • edited July 2015
    I am guessing that you are using an earlier version of Harlowe because your example works correctly in Harlowe 1.1.1 which comes with Twine 2.0.8

    If I add you example into a new story using Twine 2.0.8 and Harlowe 1.1.1
    (set: $ar to (a: 1,4,5))
    (move: $ar's 1st into $trash)
    $ar
    
    ... it outputs the following in Test/Play/Publish
    4,5
    I suggest updating to latest version of Twine 2 and Harlowe.
  • Yes, it helps, thank you.
Sign In or Register to comment.