Kampfkarren / selene

A blazing-fast modern Lua linter written in Rust

Home Page:https://kampfkarren.github.io/selene/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

expected `"function"`, received `function`

kasper93 opened this issue · comments

error[incorrect_standard_library_use]: use of standard_library function `mp.add_key_binding` is incorrect
     ┌─ player/lua/osc.lua:2974:20
     │
2974 │ mp.add_key_binding(nil, "visibility", function() visibility_mode("cycle") end)
     │                    ^^^ expected `"nil", "string"`, received `nil`
error[incorrect_standard_library_use]: use of standard_library function `mp.add_key_binding` is incorrect
     ┌─ player/lua/osc.lua:2974:39
     │
2974 │ mp.add_key_binding(nil, "visibility", function() visibility_mode("cycle") end)
     │                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `"function"`, received `function`

  mp.add_key_binding:
    args:
      - type:
          - nil
          - string
        observes: read
      - type:
          - function
          - string
        observes: read
      - type:
          - function
        observes: read
        required: false
      - type:
          - table
        observes: read
        required: false

selene standard libraries don't support union types, so you're currently using the "list of strings" behavior, which is for constant strings:

Constant list of strings - Will check if the value provided is one of the strings in the list. For example, collectgarbage only takes one of a few exact string arguments--doing collectgarbage("count") will work, but collectgarbage("whoops") won't.