How CAN tolua work with overloaded functions?
We use the exact same method of binding the functions manually and we DO have to analyse the parameter types ourselves.
For example I see there are two cEntity::AddPosition overloads exported to tolua. They are registered like this:
No extra information has been given about the signature of the function so it cannot be handled by "tolua_function" itself. However two different function pointers are now bound to the same function name.
I do not know for sure, but I suspect the last statement just overwrites the first one, or the last one is ignored because the function is already registered.
tolua_AllToLua_cEntity_AddPosition00/01 are already specialized for their overloaded counterparts so there is no actual overloading done in there, they can only call one C++ function.
Either we're doing something wrong, or tolua does not really support overloading functions
We use the exact same method of binding the functions manually and we DO have to analyse the parameter types ourselves.
For example I see there are two cEntity::AddPosition overloads exported to tolua. They are registered like this:
Code:
tolua_function(tolua_S,"AddPosition",tolua_AllToLua_cEntity_AddPosition00);
tolua_function(tolua_S,"AddPosition",tolua_AllToLua_cEntity_AddPosition01);
No extra information has been given about the signature of the function so it cannot be handled by "tolua_function" itself. However two different function pointers are now bound to the same function name.
I do not know for sure, but I suspect the last statement just overwrites the first one, or the last one is ignored because the function is already registered.
tolua_AllToLua_cEntity_AddPosition00/01 are already specialized for their overloaded counterparts so there is no actual overloading done in there, they can only call one C++ function.
Either we're doing something wrong, or tolua does not really support overloading functions