lua_settable(L, -3);
}
+__LJMP static int hlua_dump_object(struct lua_State *L)
+{
+ const char *name = (const char *)lua_tostring(L, lua_upvalueindex(1));
+ lua_pushfstring(L, "HAProxy class %s", name);
+ return 1;
+}
+
/* This function check the number of arguments available in the
* stack. If the number of arguments available is not the same
* then <nb> an error is throwed.
/* Create and fill the metatable. */
lua_newtable(gL.T);
+ /* Create the __tostring identifier */
+ lua_pushstring(gL.T, "__tostring");
+ lua_pushstring(gL.T, CLASS_MAP);
+ lua_pushcclosure(gL.T, hlua_dump_object, 1);
+ lua_rawset(gL.T, -3);
+
/* Create and fille the __index entry. */
lua_pushstring(gL.T, "__index");
lua_newtable(gL.T);
/* Create and fill the metatable. */
lua_newtable(gL.T);
+ /* Create the __tostring identifier */
+ lua_pushstring(gL.T, "__tostring");
+ lua_pushstring(gL.T, CLASS_CHANNEL);
+ lua_pushcclosure(gL.T, hlua_dump_object, 1);
+ lua_rawset(gL.T, -3);
+
/* Create and fille the __index entry. */
lua_pushstring(gL.T, "__index");
lua_newtable(gL.T);
/* Create and fill the metatable. */
lua_newtable(gL.T);
+ /* Create the __tostring identifier */
+ lua_pushstring(gL.T, "__tostring");
+ lua_pushstring(gL.T, CLASS_FETCHES);
+ lua_pushcclosure(gL.T, hlua_dump_object, 1);
+ lua_rawset(gL.T, -3);
+
/* Create and fille the __index entry. */
lua_pushstring(gL.T, "__index");
lua_newtable(gL.T);
/* Create and fill the metatable. */
lua_newtable(gL.T);
+ /* Create the __tostring identifier */
+ lua_pushstring(gL.T, "__tostring");
+ lua_pushstring(gL.T, CLASS_CONVERTERS);
+ lua_pushcclosure(gL.T, hlua_dump_object, 1);
+ lua_rawset(gL.T, -3);
+
/* Create and fill the __index entry. */
lua_pushstring(gL.T, "__index");
lua_newtable(gL.T);
/* Create and fill the metatable. */
lua_newtable(gL.T);
+ /* Create the __tostring identifier */
+ lua_pushstring(gL.T, "__tostring");
+ lua_pushstring(gL.T, CLASS_HTTP);
+ lua_pushcclosure(gL.T, hlua_dump_object, 1);
+ lua_rawset(gL.T, -3);
+
/* Create and fille the __index entry. */
lua_pushstring(gL.T, "__index");
lua_newtable(gL.T);
/* Create and fill the metatable. */
lua_newtable(gL.T);
+ /* Create the __tostring identifier */
+ lua_pushstring(gL.T, "__tostring");
+ lua_pushstring(gL.T, CLASS_TXN);
+ lua_pushcclosure(gL.T, hlua_dump_object, 1);
+ lua_rawset(gL.T, -3);
+
/* Create and fille the __index entry. */
lua_pushstring(gL.T, "__index");
lua_newtable(gL.T);
/* Create and fill the metatable. */
lua_newtable(gL.T);
+ /* Create the __tostring identifier */
+ lua_pushstring(gL.T, "__tostring");
+ lua_pushstring(gL.T, CLASS_SOCKET);
+ lua_pushcclosure(gL.T, hlua_dump_object, 1);
+ lua_rawset(gL.T, -3);
+
/* Create and fille the __index entry. */
lua_pushstring(gL.T, "__index");
lua_newtable(gL.T);