Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New proposal about exec and switches #45

Closed
Berrysoft opened this issue Dec 4, 2022 · 0 comments · Fixed by #46
Closed

New proposal about exec and switches #45

Berrysoft opened this issue Dec 4, 2022 · 0 comments · Fixed by #46

Comments

@Berrysoft
Copy link
Contributor

Berrysoft commented Dec 4, 2022

解耦合 exec

exec 做成 line plugin。允许一个插件调用另一个插件( #14 )。

简化 switches

不再允许每个选项后面给出代码,这样能够解决 #24

每个选项默认绑定其顺序对应的数字名称变量,默认值为 true;被选择的选项将进入 $?。例如:

- exec: $1 = false
- switches:
  - Switch 1
  - Switch 2
  - Switch 3
- exec: $n = $?

在上述示例中,第一、三个选项可用而第二个选项不可用;$n 的值可能取0或2。

有关默认值的考虑:

  • 如果设定成 false 可用而 true 不可用,太扭曲了。
  • 但是一个 bool 值默认是 true 也很扭曲。
  • 因此决定,如果这个变量是 null 的时候为 true,其它情况与正常变量保持相同。这并不构成 Ayaka Script 的例外规则,而是 switches 的特殊规则。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant