lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I'm creating a lightweight "shell" module (github.com/schollii/bluash), along the lines of a couple other Lua projects (luash and grunt, neither of them maintained). 

Couple questions about operator overloading: 
  1. Any gotchas that I should be aware of in overloading the modulo (%) and greater-than (>) operators? Ideas of how I would use this are on the bluash wiki (Piping, and String Operations -- no implementation yet). I would have preferred >> or << as operators, like in C++, hence my next question.
  2. How difficult is it to extend Lua to support new binary operators? Beyond defining the symbol, the associated metamethod name, the precedence relative to other operators, and left/right association, is there a lot more to it (notionally)? Would it be rather straightforward to extend Lua DLL code? (I have lots of exp in C++, but never looked at the Lua C code). 
Cheers, 
Oliver