From: Mark G. <ma...@go...> - 2008-10-16 03:50:50
|
> > We recently upgraded SWIG from version 1.1.31 to 1.1.36 and > have hit a small problem (probably nothing, just can't > figure it out). C++ constant variables used to be SWIGed, > and accessible through module.ConstName_get() from a LUA > script in the oldest of the two versions. However, there > doesn't seem to be a function to obtain the variable > value in the newest version. I have tried to obtain the > value with in different ways, but have not been able to. > It's also the same for every variable contained in the > swig_variables array. Thanks for enlightening me as to how I > should procede to get the constant value. > > St?fan Beauchamp Hello St?fan, The quick answer is I removed it. When I first wrote the Lua bindings. const Foo ConstName; Would produce a function module.ConstName_get(), so in Lua you could do. a=module.ConstName_get() -- or b=module.ConstName However sometime back (probably about 1.3.33 or so), I discovered how to stop adding the module.ConstName_get() and just use module.ConstName So, you can just use module.ConstName instead, which is IMHO much nicer. The following code will work: a=module.ConstName someFunction(module.ConstName) module.ConstName:someMethod(1,2,3) This code will not module.ConstName=something It will generate an error ("this variable is immutable") If you _really_ wanted the function back the following code would add it in. %native(ConstName_get) int _wrap_ConstName_get(luaState*); Hope this clarifies the matter. PS. For shared variables, the get and set functions have vanished for the same reasons. Hope this helps, Mark |