lua-users home
lua-l archive

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


Hi all!

How do you Init an ai script?

And how do you update it...


Ive tried init like with:

luaL_loadfile(LUA()->m_lua, "primitive_cubeAI.lua");

and call it everyframe with:

lua_call(LUA()->m_lua, 0, LUA_MULTRET);

is this the right way to do this?

thx


-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Petter
Rønningen
Sent: Friday, July 15, 2005 11:03 PM
To: Lua list
Subject: Re: lua_State and garbage collection

Awesome, that sounds perfect. Thanks a lot.

- Petter Rønningen

On 7/16/05, Ben Sunshine-Hill <sneftel@gmail.com> wrote:
> You're just keeping all the threads around in the C stack of the main
> thread? That'll work, I suppose, but is not the best way to keep a
> reference around. Use luaL_ref to get an integer reference to the
> thread, and pop it off the stack. Store the references in your
> std::map<float, int>, and access the threads using luaL_getref. When
> you're ready to forget about a thread, just use luaL_unref; since it's
> the only remaining reference to the thread, the GC will handle the
> rest.
> 
> Ben
>