lua-users home
lua-l archive

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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/22/2010 3:04 AM, Christian Tellefsen wrote:
> The main issue with the wrapping is that it seems to me to be hard to
> support dynamic typing very well. For example, we may have an argument
> that's a position. For the position, the scripter can send in not only a
> vector, but also the name of a point, the unique ID of a game object, or
> a reference to a game object. All of these will resolve to a position.
> 
> But, in other cases the input might be a velocity vector, for which this
> wouldn't make sense.
> 
> So, the wrapper layer would have to be able to generate different
> binding code for these functions:
> 
> GameObject::SetVel(Vec3 vel);
> GameObject::SetPos(Vec3 pos);

SetPos() shouldn't take a Vec3, if you're passing it a string. It should
take a Pos() type that has

Pos(char*)
Pos(Vec3())
Pos(int)
Pos(GameObject&)
Vec3     getVec()

Then you can:

1. Do the same thing from C++: Pass any of those data types in and have
them auto-convert. The C++ function would just call pos.getVec() to get
the computed Vec3.

2. Make your "Pos" converter auto-convert from those objects to a Pos
(which is what you're doing now, only it would now match the C++
behavior and the given signature of the function.

Tim
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNEi8lAAoJENSbqLBCyKKsJpkIAJ5xz4cchyT4CG0e8yKsM8bL
EMAnNNnr68iFlgsE+u90b19j2FZuvI/WzSGSVcsVpLlq+5+xWv7kZ/stObozWhPJ
wu1ige+ugYKtDqXQUJsbNhyh5AXlBUfOPI9LquPnjZwipEUY5rWt6YiZohny7/Mp
hnUCELR7iBm4djKBD1HSWhCz613KFf8KrZ1jc9/RwMT3vWLKJiLa422z/ZLljXeT
6eSCACk9rr8N9BglZb3+W/knGxRxBqqQtno0qx/fU0V+FUsxNQmy6ktEMSxqplSU
KUZHIiGui3r49tKe9dGm54D3TlzDcfoDPFyagetNkAGeHp4l4W3w3V54tqX6wkU=
=2aG2
-----END PGP SIGNATURE-----