lua-users home
lua-l archive

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


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