Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4883

Thrift 0.12.0 source lua lib has a mistake

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 0.12.0
    • None
    • Lua - Library

    Description

      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

      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Ā 

      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
      

      Attachments

        1. Thrift.lua
          7 kB
          Nguyen Duc Duy

        Issue Links

          Activity

            People

              Unassigned Unassigned
              duy-ce Nguyen Duc Duy
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m