lua-users home
lua-l archive

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


Well, since it has been proven that this can already be achieved using LUA
itself for example, I can't say that I have an case that I can't implement
without this additional feature.
However, the initial problem of being able to pass arguments to a chunk can
easily be found. For example, I have game entities for which AI is written
in LUA. The whole AI stuff regarding a given entity type is stored in a
table. My current mechanism is that the script must fill a table referenced
by a global variable with a given name (specific to the entity type), and
the engine knows that name, thus it can easily be retrieved as a global
variable after the script is run. But of course, this creates a dependance
and a useless global reference (since each game entity has somewhere a
reference to that table).
I would like to remove the need for this "hard-coded" global name, but this
means that the host program must pass a table to the script, that will be
filled.
Instead of that, I must run the script, then find a global variable. (Well
actually this is what I am currently doing, but of course I could change
that now at the expense of a double function call).

Also chunks can already return values, and for completeness if nothing else,
it would be a good idea to allow argument passing as well.


Cheers,


Benoit.

-----Message d'origine-----
De : Abisoft opetusohjelmat [mailto:info@abisoft.fi]
Envoyé : vendredi 21 février 2003 21:09
À : Multiple recipients of list
Objet : Re: [new feature proposal for versions after 5.0 final] passing
argum ents to chunks



What would be the use of this - can you give any real-world example?