2010/4/10 Matthias Pfafferodt <no-reply.invalid-addr...@gna.org>:
>
> Follow-up Comment #2, bug #13709 (project freeciv):
>
> I do not know lua. But if there are no compatibility problems I think this
> can go into 2.2.1. Do we need toluaxx after this change?


In my testing, it seems to work almost exactly the same. Only corner
cases differ (for some reason, toluaxx does not allow 'nil' for const
char *, but tolua-5.1 allows 'nil' -> NULL. More on this later below).
We don't need toluaxx after this change.

Question to Marko: Is it okay to patch tolua-5.1 to use tolua_outside.
The implementation is already attached and is relatively trivial. This
is a feature that makes a lot of sense for Freeciv's object oriented
C.

Followup question to Marko: Is it then okay, to add a further feature
to tolua-5.1?

I want a variable modifier 'tolua_notnil' to mark those API function
arguments that may not be nil (converted to NULL).  The intended
change reduces overhead (less code in tolua, since explicit isnil ||
isusertype check is changed to isusertype) and we can remove almost
all our SCRIPT_ASSERT / argument checking boilerplate (which is much
less code), and user error messages will be easier to understand (for
example: "argument #2 is 'nil', expected 'Building_Type'")

I have a working prototype of tolua_notnil

Compatibility notes:

If we use tolua_outside, our api.pkg will depend on that modification
of tolua (however toluaxx and tolua++ are compatible alternatives).
If we use tolua_notnil, it is still possible to use an unpatched tolua
(losing the safety) by just undefining tolua_notnil:

$#ifndef tolua_notnil
$#define tolua_notnil
$#endif

Ulrik

_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to