lua_pushnumber(L, 3);
lua_setfield(L, -2, "bar");
lua_pop(L,1);

luaL_dostring(L,"foo.bar=3");
lua_pop(L,1);

luabind::globals(L)["foo"]["bar"] = 3;
lua_pop(L,1);