本项目 .j 文件中的 Zinc(//! zinc ... //! endzinc)语法与约定:库/结构体写法、匿名函数(无闭包)最佳实践、回调参数传递、资源释放/置空、以及 JASS->Zinc 迁移要点。
//! zinc / //! endzinc 包裹 Zinc 代码块。++/--;用 += 1 / -= 1。break/continue;用 if 分支或布尔开关改写。type name[];,不要写大小(例如 integer a[10] 是错的)。-> type 写在参数列表后;无返回可省略。library 作用域只允许 function 与普通全局变量;不要写 static method、method、private static integer 这类结构体语法。需要 method/static 时请放进 struct。static 成员变量,并在回调结束后立刻清理为默认值(null/0/"")。CreateTrigger + TriggerAddCondition + ,随后 并置 。TriggerEvaluateDestroyTriggernulltimer/trigger/group/effect/location/...):按对应 Destroy* / Remove* API 释放,并在作用域末尾 = null。method onDestroy();不要自定义 destroy()。static method foo(...) -> type { ... }method foo(...) -> type { ... }struct X [] { ... }(避免 create/destroy)。public;Zinc 默认 private:需要对外可见的函数/全局变量要显式 public。loop/exitwhen/endloop 优先改写为 Zinc 的范围 for (a <= i <= b) 或常规 for。references/jass-to-zinc.mdreferences/anonymous-functions.mdreferences/callback-params.mdreferences/method-syntax.md