luabind: problem retrieving values from table indexed by non-built-in classes

qwer 1304 <[email protected]> Wed, 25 Apr 2012 16:05:27 +0300
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
Hi,
I'm using luabind 0.9.1 from Ryan Pavlik's master distribution with Lua 5.1, cygwin on Win XP SP3 + latest patches x86, boost 1.48, gcc 4.3.4. Lua and boost are cygwin pre-compiled versions.
I've successfully built luabind in both static and shared versions.
Both versions pass all the tests EXCEPT for the test_object_identity.cpp test which fails in both versions.
I've tracked down the problem to the following issue:If an entry in a table is created for NON built-in class (i.e., not int, string, etc), the value CANNOT be retrieved.
Here's a code piece that demonstrates this:
#include "test.hpp"#include <luabind/luabind.hpp>#include <luabind/detail/debug.hpp>
using namespace luabind;
struct test_param{	int obj;
};
void test_main(lua_State* L){	using namespace luabind;
	module(L)	[		class_<test_param>("test_param")			.def_readwrite("obj", &test_param::obj)	];
	test_param temp_object;	object tabc = newtable(L);	tabc[1] = 10;	tabc[temp_object] = 30;
	TEST_CHECK( tabc[1] == 10 );              // passes	TEST_CHECK( tabc[temp_object] == 30 );    // FAILS!!!
}
tabc[1] is indeed 10 while tabc[temp_object] is NOT 30! (actually, it seems to be nil)
However, if I use iterate to go over tabc entries, there're the two entries with the CORRECT key/value pairs.
Any ideas?
Thx,David

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user