Nguyen Duc Duy created THRIFT-4883:
--------------------------------------

             Summary: Thrift 0.12.0 source lua lib has a mistake
                 Key: THRIFT-4883
                 URL: https://issues.apache.org/jira/browse/THRIFT-4883
             Project: Thrift
          Issue Type: Bug
          Components: Lua - Library
    Affects Versions: 0.12.0
            Reporter: Nguyen Duc Duy
             Fix For: 0.13.0
         Attachments: Thrift.lua

{code:java}
function __TObject:new(init_obj)
  local obj = {}
  if ttype(obj) == 'table' then
    obj = init_obj
  end

  -- Use the __parent key and the __index function to achieve inheritance
  obj.__parent = self
  setmetatable(obj, __TObject.__mt)
  return obj
end{code}
In the above code in file Thrift.lua from lib lua in thrift project. I saw that 
it should check if init_obj is a table but this code is checking obj(a table as 
declare ?).

So i think the source must beĀ 
{code:java}
function __TObject:new(init_obj)
  local obj = {}
  if ttype(init_obj) == 'table' then
    obj = init_obj
  end

  -- Use the __parent key and the __index function to achieve inheritance
  obj.__parent = self
  setmetatable(obj, __TObject.__mt)
  return obj
end
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to