Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix script_copy_value for LUA_TTABLE #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ikavalio
Copy link

Hi,

Current implementation of script_copy_value is incorrect for LUA_TTABLE and is 'reversing' the table:

local threads = {}

function setup(thread)
   table.insert(threads, thread)
end

function init(args)
   statuses = {}
end

function response(status, headers, body)
   if statuses[status] then
      statuses[status] = statuses[status] + 1
   else
      statuses[status] = 1
   end
end

function done(summary, latency, requests)
   local results = {}
   for index, thread in ipairs(threads) do
      local statuses = thread:get("statuses")
      for key, value in pairs(statuses) do
         local msg = "%d - %d" 
         print(msg:format(key, value))
      end
   end
end

Prints smth like:

8 - 200
12 - 500

Instead of correct

200 - 8
500 - 12

This patch fixes it.

@kpelelis
Copy link

Bump

@mpokryva
Copy link

Any plans to fix this? Still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants