[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: tolua bug?
- From: Mike Clifton <mclifton@...>
- Date: Tue, 20 Jan 2004 15:15:16 -0700
I've run into a problem with tolua, and I'm not sure if I'm using tolua
incorrectly, or if this is a bug/limitation of tolua.
Suppose I have a package file that looks something like this:
module Test {
typedef struct {
float x;
float y;
} vector2d;
typedef struct {
float x;
float y;
float z;
} vector3d;
}
When I run tolua, the generated code contains multiple functions with
the same name. For example, I have two of each of the following functions:
static int tolua_get_Test_x(lua_State* tolua_S)
static int tolua_set_Test_x(lua_State* tolua_S)
static int tolua_get_Test_y(lua_State* tolua_S)
static int tolua_set_Test_y(lua_State* tolua_S)
The body of one of these functions would work with the vector2d type,
and one of them would work with the vector3d type. Unfortunately, they
both have the same name, and so the generated file won't compile. It
seems that naming the functions like this would make more sense:
static int tolua_get_Test_vector2d_x(lua_State* tolua_S)
static int tolua_get_Test_vector3d_x(lua_State* tolua_S)
...etc...
So, my question comes down to: am I making some mistake - am I using
tolua incorrectly? Or, is this a bug in tolua?
Is it possible to use tolua with two unrelated structs (or classes) that
happen to have fields with the same names?
If this is a bug in tolua, can someone point me to the spot in the tolua
source code that I might be able to fix it myself?
I've actually been using tolua for a while with good success, but have
only exposed some methods of C++ classes so far. I only ran into this
problem recently when I tried to expose the fields of some structs. I
hope there's some way to work around this problem without too much
difficulty.
Thanks,
Mike