lua-users home
lua-l archive

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


Sorry, I wasn't clear on my question!

There are som binders (tolua, for example), that
allows to create and access objects methods and
properties.

I would like to creat my own binder.

I know how to bind methods, but properties are a
little trickier to me.


If I have this class

class Vector2D{
public:
  int x;
  int y;
public:
  Vector2D();

  int lenght();
};


I would like to map the method 'lenght' to the C
funcion Vector2D_lenght, the property 'x' to
Vector2D_get_x and Vector2D_set_x and the property 'y'
to  Vector2D_get_y and 
Vector2D_set_y.  


vec = Vector2D()

vec.x = 10 -- calls Vector2D_set_x
vec.y =  5 -- calls Vector2D_set_y

local x = vec.x -- calls Vector2D_get_x
local y = vec.y -- calls Vector2D_get_y

vec:lenght() -- calls Vector2D_lenght



Is there some way to provide fast access to these
function?





	



	
		
_______________________________________________________ 
Yahoo! doce lar. Faça do Yahoo! sua homepage. 
http://br.yahoo.com/homepageset.html