Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

[Twine 2.1.1][SugarCube 2.14] Passing anonymous function to a widget/macro directly

$
0
0
Hey there,

This is more of a cosmetic questions, but still important to me. I'm trying to pass an anonymous function to a widget that would use that function to filter items in an inventory for me. Here's how the call looks like:

This doesn't work:
 <<listItemsFiltered $player function(item){return item.type === 'top'}>>

This works, but I'm passing a function that was assigned.
<<set $showTopsOnly to function(item){return item.type === 'top'}>>
<<listItemsFiltered $player $showTopsOnly>>

Any ideas of what I'm doing wrong here?

Viewing all articles
Browse latest Browse all 1844

Trending Articles