THRIFT-5106: Fix various Lua library and compiler issues
Client: lua
Patch: Jeffrey Han

This closes #2014
diff --git a/lib/lua/TCompactProtocol.lua b/lib/lua/TCompactProtocol.lua
index 7b75967..8e7db8e 100644
--- a/lib/lua/TCompactProtocol.lua
+++ b/lib/lua/TCompactProtocol.lua
@@ -314,10 +314,10 @@
 
 function TCompactProtocol:readMapBegin()
   local size = self:readVarint32()
-  if size < 0 then
-    return nil,nil,nil
+  local kvtype = 0
+  if size > 0 then
+    kvtype = self:readSignByte()
   end
-  local kvtype = self:readSignByte()
   local ktype = self:getTType(libluabitwise.shiftr(kvtype, 4))
   local vtype = self:getTType(kvtype)
   return ktype, vtype, size
@@ -426,7 +426,7 @@
   local data = result(0)
   local shiftl = 0
   while true do
-    b = self:readByte()
+    b = self:readSignByte()
     endFlag, data = libluabpack.fromVarint64(b, shiftl, data)
     shiftl = shiftl + 7
     if endFlag == 0 then