[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Using lightweight userdata to deal with objects
- From: Jose Marin <jose_marin2@...>
- Date: Fri, 9 Jan 2004 10:49:17 -0300 (ART)
I think that Lightweight userdata will solve my
problem.
All I need is to create functions to:
Create the object
player = NewPlayer()
or
player = Player:new()
this creates a Lightweight userdata, perhaps like this
userdata = new CPlayer();
lua_pushuserdata(userdata);
Manage the object
player:move(dx, dy)
player:fire(target)
Destroy the object
player:delete()
perhaps like this
delete userdata;
all functions ( new, move fire, delete) are C
functions, that take the Lightweight userdata and
casts it to CPlayer*
How do this in Lua?
I thank this will be fast!
______________________________________________________________________
Conheça a nova central de informações anti-spam do Yahoo! Mail:
http://www.yahoo.com.br/antispam