Luci

depends

Examples:

- opt:depends("foo", "test")
    Require the value of `foo` to be `test`.

- opt:depends({ foo: "test" })
    Equivalent to the previous example.

- opt:depends({ foo: /test/ })
    Require the value of `foo` to match the regular expression `/test/`.

- opt:depends({ foo: "test", bar: "qrx" })
    Require the value of `foo` to be `test` and the value of `bar` to be `qrx`.

- opt:depends({ foo: "test" })
- opt:depends({ bar: "qrx" })
    Require either foo to be set to test, or the bar option to be qrx.

- opt:depends("test.section1.foo", "bar")
    Require the "foo" form option within the "section1" section to be set to "bar".

- opt:depends({ foo: "test", "!contains": true })
    Require the "foo" option value to contain the substring "test".
原文地址:https://www.cnblogs.com/thammer/p/14931905.html