BUG/MINOR: hlua: hlua_channel_insert_data() behavior conflicts with documentation

Channel.insert(channel, string, [,offset]):

When no offset is provided, hlua_channel_insert_data() inserts
string at the end of incoming data.

This behavior conflicts with the documentation that explicitly says
that the default behavior is to insert the string in front of incoming data.

This patch fixes hlua_channel_insert_data() behavior so that it fully
complies with the documentation.

Thanks to Smackd0wn for noticing it.

This could be backported to 2.6 and 2.5
diff --git a/src/hlua.c b/src/hlua.c
index ee48f5c..19932a5 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -3573,7 +3573,7 @@
 }
 
 /* Inserts a given amount of input data at the given offset by a string
- * content. By default the string is appended at the end of input data. It
+ * content. By default the string is appended in front of input data. It
  * returns the length of the written string, or -1 if the channel is closed or
  * if the buffer size is too little for the data.
  *
@@ -3599,13 +3599,13 @@
 	if (filter && !hlua_filter_from_payload(filter))
 		WILL_LJMP(lua_error(L));
 
-	offset = input + output;
+	offset = output;
 	if (lua_gettop(L) > 2) {
 		offset = MAY_LJMP(luaL_checkinteger(L, 3));
 		if (offset < 0)
 			offset = MAX(0, (int)input + offset);
 		offset += output;
-		if (offset < output || offset > output + input) {
+		if (offset > output + input) {
 			lua_pushfstring(L, "offset out of range.");
 			WILL_LJMP(lua_error(L));
 		}