[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: constructors in tolua++
- From: Peter Kümmel <syntheticpp@...>
- Date: Thu, 05 May 2005 01:20:41 +0200
Hello,
I've done a very simple binding of two c++ classes to lua
with tolua++1.0.5 and get a error with a constructor which
not uses the new command:
--header file tv.h:
struct A { A(){}; };
struct B { B(){}; };
--pkg file tv.pkg:
$#include "tv.h"
struct A { A(){}; };
struct B { B(){}; };
--main.cpp:
extern "C" {
#include "lualib.h"
#include "lauxlib.h" }
int main (void){
int tolua_tv_open (lua_State*);
lua_State* L = lua_open();
luaopen_base(L);
tolua_tv_open(L);
lua_dofile(L,"tv.lua");
lua_close(L);
return 0;
}
--lua code tv.lua:
v = B.new print("B.new done")
v = A.new print("A.new done")
v = B() print("B() done")
v = A() print("A() done")
And this is the ouput of the program:
B.new done
A.new done
B() done
tv.lua:4: error in function 'new'.
argument #1 is 'class A'; 'B' expected.
Is it my fault or is it a bug of tolua++?
Best regards,
Peter