divert target variables #48
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Right now it's not possible to divert to content dynamically. The quick and dirty solution would be to allow specifying a divert target via h-expression, but this would only allow storing a STRING divert target. The 'gotcha' here being that divert targets are scoped, and scope should be preserved, rather than forcing the dev to store fully qualified target strings.
Maybe for this I can make another syntax extension to embedded haxe along the lines of what I've done with
,,,and,. The syntaxInkuses for divert target variables is-> target, so if I enable something liketarget = ->target_namethat gets transmuted intotarget = story.storyTree.resolveInScope(target_name)and make sure divert statement evaluation can tell the difference between a string target and a node target.The more syntax extensions I make to hscript, the more appealing it becomes to fork it and start modifying the source instead of doing crude find-and-replacement as it currently is.
potential problem with the
->syntax:->is already part of Haxe function type syntax.I was starting to think I had hit bedrock on this (and other syntax extensions like #51) but just maybe operator overloading is the answer.
https://haxe.org/manual/types-abstract-operator-overloading.html
https://haxe.org/manual/types-numeric-operators.html#unary
Or even better: creating new operators, extending Interpreter, etc:
5ce4fbd74d/README.md (advanced-usage)