In Lua it's possible to return more than one value, For example:
function math.pos(x1, y1, x2, y2)
return x2 - x1, y2 - y1
end
distanceX, distanceY = math.pos(100, 100, 300, 300) --> distanceX = 0, distanceY = 0
Can I do something like this in ChaiScript?
This isn't possible in ChaiScript, although you can fake it using a structure containing multiple values.
You would have a structure (in C++) that would look a little like this:
You then register it with ChaiScript like so:
Then you can use it like this: