[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: My experience with Lua so far
- From: "mos" <mmosquito@...>
- Date: Tue, 6 Jun 2006 14:59:09 +0800
> I really think I am rambling now, so I will stop.
No, not a bit. I am very glad to share your experience . more or
less there are something like between us. I am developing a MMORPG now, As
imporing more and more lua to my project , I also find something exciting.
1. As most of Game to do, use lua on GUI, Game task,
2. Use lua in fight compute then let the designer to do it as free
as their wish, I know it is slow, and I will translate them back to c++ when
3. Use lua on test. it is much more better than cppuit for ---- no
need complile, it is can be easily managed by files. for example my test
folder is like
and test suite is like RunScriptFolder('test_item')
4. It is very diffcult what a test invoke both client and server,
but use lua coroutine can easily handle it.
for example, on client
StartThread('thread') -- will call lua_newthread and
resume function thread
connecttoserver() -- when connected will call back
SendCmd(cmd_login,"Login('test')") -- net send a
comand, when login ok or not , will call back here
-- do your test ...
and I even use lua to write robot on pressure test
5. It is very easy to write npc with special behaviour by coroutine
Say('I am hungry')
BUT most headache is I don't know how to end a luathread , there
just a function lua_newthread but not a function lua_endthread, why ?
as my prev mail said I do it like:
lua_State* m_L = lua_newthread(L);
int refKey = luaL_ref(L, LUA_REGISTRYINDEX);
NPC->L = L
NPC->m_L = m_L
NPC->refKey = refKey
and I still have no confidence about that .