These are chat archives for ChaiScript/ChaiScript

3rd
Mar 2018
Tharindu Mathew
@mackiem
Mar 03 2018 01:24
Error: "Can not find appropriate '-' operator." With parameters: (struct glm::tvec3<float,0>, struct glm::tvec3<float,0>) during evaluation at (agent.chai 21, 20)

2 overloads available:
(const Number)
(const Number, const Number)

agent.chai (21, 20) '(my.position - other.position)'
from agent.chai (21, 13) 'var away=(my.position - other.position)'

i believe it's confusing the unary negative operator with the one that takes two, is there anyway I can support this in chaiscript
Jason Turner
@lefticus
Mar 03 2018 01:34
Like any other function you can expose it to chaiscript with something like: "chai.add(chaiscript::function(&glm::tvec3<float,0>::operator-)), "-") or if that does not work because it's a free function or there are too many overloads, simply wrap it in a lambda: chai.add(chaiscript::function([](const glm::tvec3<float, 0> &lhs, const glm::tvec3<float, 0> &rhs,){ return lhs - rhs; })), "-");
Tharindu Mathew
@mackiem
Mar 03 2018 01:35
cool, we should take all these stuff in the chat and put it into a wiki or something
Jason Turner
@lefticus
Mar 03 2018 01:37
I would greatly appreciate it if anyone wanted to contribute to the cheatsheet https://github.com/ChaiScript/ChaiScript/blob/master/cheatsheet.md
Tharindu Mathew
@mackiem
Mar 03 2018 01:45
will try to contribute to that
Jason Turner
@lefticus
Mar 03 2018 02:43
I've found in the past that no one ever reads the formal docs, so I largely stopped maintaining them. The cheatsheet is supposed to be up to date tho