You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to use a parent node inside a dynamic node?
#1041
I have the snippet below. I want to use a repeat node inside the dynamic node that depends on a node outside of the dynamic node. I've illustrated what I mean in the snippet below.
s(
{ trig="when(%d+)", dscr="conditional signal assignment", regTrig=true },
fmta(
[[ <> <<= <> when <> = <> else<>]],
{
i(1, "output_signal"),
i(2, "output_signal_value_1"),
i(3, "select_signal"), -----------> I want to use this node inside the dynamic nodei(4, "select_signal_value_1"),
d(5, function(_, snip)
localnum_cases=tonumber(snip.captures[1]) -1localnodes= {}
forj=2, num_casesdolocalcase_node=isn(j-1,
fmta(
[[ <><> when <> = <> else]],
{
t({"",""}),
i(1, "output_signal_value_"..j),
i(2, "select_signal"), --<------------- I want to use the captured text from parent here as a rep nodei(3, "select_signal_value_"..j),
}
),
"$PARENT_INDENT"
)
table.insert(nodes, case_node)
ifj~=num_casesthentable.insert(nodes, t({""}))
elsetable.insert(nodes, sn(j, { t({"", ""}), i(1, "output_value_"..j), t({";"}) }))
endendreturnisn(nil, nodes, "$PARENT_INDENT\t")
end, nil),
}
)
),
Fixed code below in case someone stumbles upon this in the future.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I have the snippet below. I want to use a repeat node inside the dynamic node that depends on a node outside of the dynamic node. I've illustrated what I mean in the snippet below.
Fixed code below in case someone stumbles upon this in the future.
All reactions