lua-users home
lua-l archive

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

Hi there,

I export an array of class instances to Lua. I use "tolua" with a pkg-file  
like this:

$#include "Test.h"

class Test
  int bla;
  void do_something();

extern Test *test[2];

test[0] and test[1] are defined (in my C++ code) in this way:

Test *test[0] = new Test();
Test *test[1] = new Test();

Well, in Lua I must access 'do_something' like this (for test[0]):


Is there any way to avoid the first or second mention of test[1]?
The function will always use the first parameter as its object, so I could  
also write:


I think it would have the same effect (?).

So... what's the proper way of doing this?

Thx a lot,