[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Question about pointer......
- From: Ben Sunshine-Hill <bsunshin@...>
- Date: Wed, 05 Mar 2003 19:28:51 -0800
> I would like to ask a question.... for a MMO RPG wrote by C++ and
> using LUA as a script tools..... when a player access the script like
>
> the following..
>
> if (gold >= 5000)
> Dec(gold, 5000)
>
> How do the server know which player will be decreased $5000 since
> in LUA doesn't know the player UIN......
Lua will know the player UIN if you tell it the player UIN. But I think your
code would probably look more like the following:
if(myPlayer.gold >= 5000) then
myPlayer.gold -= 5000
end
For a good discussion of sharing data between C/C++ and Lua, I suggest you
check out the Wiki at http://lua-users.org . There's quite a lot of info
there. In particular, pay attention to tolua and SWIG.
Ben