Overview
@operator tells GLuaLS what a class supports for operators like +, ==, #, indexing, or calling.
Use it in annotation files or class definitions when GLuaLS cannot infer the operator behavior.
Syntax
Usage
Add the operator on the class before the local assignment or returned table:Supported Operators
- Arithmetic:
add,sub,mul,div,mod,pow,unm(unary minus) - Bitwise:
band,bor,bxor,shl,shr,bnot - Other numeric:
idiv - Relational:
eq,lt,le - Other:
len(length operator#),concat(concatenation..),call,index
pairs, but it does not use pairs for type inference yet, so this page does not list it as supported.