1. Igor Baidiuk
  2. love-threads-table-marshalling

Commits

Igor Baidiuk  committed 5893611

Finally found source of trouble - relative indexing on data serialization

  • Participants
  • Parent commits 11a86a5
  • Branches default

Comments (0)

Files changed (2)

File src/common/Variant.cpp

View file
  • Ignore whitespace
 	{
 		size_t len = 0;
 		const char *str = 0;
+		// normalize n to be absolute stack index
+		n = n < 0
+			? lua_gettop(L) + 1 + n
+			: n;
 
 		switch(lua_type(L, n))
 		{

File src/modules/thread/wrap_Thread.cpp

View file
  • Ignore whitespace
 
 	int w_Thread_set(lua_State *L)
 	{
+		printf(__FUNCTION__ " start\n");
+		fflush(stdout);
 		Thread *t = luax_checkthread(L, 1);
 		std::string name = luax_checkstring(L, 2);
 		int top = lua_gettop(L);
 		Variant *v = top >=3 ? Variant::fromLua(L, 3, lua_gettop(L)) : NULL;
 		if (!v)
 			return luaL_error(L, "Expected boolean, number, string, userdata, tuple or table");
+		v->prettyPrint();
 		t->set(name, v);
 		t->lock();
 		v->release();