Follow-up Comment #4, bug #13709 (project freeciv):
Thanks for your thoughts. I've been missing more discussion about script/api
Given how little that happened with scripting before, and how much that is
possible now given the momentum we have (right now), I think we should just
go forward with tolua-5.1.. Depending on a small modification for
tolua_outside is not so bad; it's not about mechanics but simply the syntax
of our api.pkg file.
Quoting the email I sent about the tolua_notnil suggestion:
> 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
tolua_notnil is part of my project to make sure there can't be any wild
pointers accessible from our Lua API (If you wonder how right now, start with
just saving a unit pointer in lua until after the unit is killed. You can also
use 'Unit[".get"]["owner"](find.player(1))' for example to the equivalent of
((struct unit *)pplayer)->owner.). This is a much deeper question that will
take lots of time.
Reply to this item at:
Meddelandet skickades via/av Gna!
Freeciv-dev mailing list