|
|
||
|
|
Hello, I have choosen the same solution as Jason. Here is a (simple) example you can do to register lua script inside a C++ class (store has a filename) In C++ pseudo-code: class LuaAI { void acting (void); //the method called to animate your buddy at each frame StlString _filename; //the AI script bool _first; lua_state* L; } void LuaAI::acting(void){ if (_first){ lua_dofile(L,_fileName.c_str()); first=false; } lua_pcall(L,0,0,0); } Something interresting can be done with this solution, instead of testing the boolean _first you can have a method that checks if the _filename has been modify since its last execution, this way you can modify "on the fly" the behavior of your character! Personnally I have choosen to have one lua_state for each character, this way each one has its own stack of execution,but again that's a personnal choice... david. Ive wrote: O interesting! Can u be more precise on this and/or point me to some example? thx -----Original Message----- From: lua-bounces@bazar2.conectiva.com.br [mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Jason Murdick Sent: Monday, July 18, 2005 3:35 PM To: Lua list Subject: Re: Attach Lua script To C++ class! Sure it is! The two ways I've stored scripts inside C++ classes is to simply store the script as a string or as a filename/path. Jason On 7/18/05, Ive <neosettlers@sympatico.ca> wrote: |
begin:vcard fn:David HERVIOU n:HERVIOU;David org;quoted-printable:Ecole Nationale d'Ing=C3=A9nieurs de Brest adr;quoted-printable;dom:BP 38;;25, rue Claude Chappe;Plouzan=C3=A9;France;29280 email;internet:herviou@enib.fr title;quoted-printable:Centre Europ=C3=A9en de R=C3=A9alit=C3=A9 Virtuelle tel;work:+33 (0)2 98 05 89 47 tel;fax:+33 (0)2 98 05 89 79 note;quoted-printable:Doctorant En Informatique au laboratoire LISyC (Laboratoire d'Informatiqu= e des Syst=C3=A8mes Complexes) dans le cadre du projet AR=C3=A9Vi. url:http://www.cerv.fr/~herviou version:2.1 end:vcard