Passing additional parameters to the http.request 'success' callback function? Possible?

I’ve never done much with http.request up until now, but I’m trying to work out if its possible to pass additional parameters to the ‘success’ (or fail!) function to modify its behaviour.

I’ve tried all the usual Lua tricks but can’t seem to get it to do what I want. I’m sure its something really easy that i’ve overlooked!

Anyone have any thoughts? :-/

How about something like this?

function setup()
    websites = {"http://www.twolivesleft.com/", "http://www.google.com/"}
    for i = 1, #websites do
        http.request(websites[i], function(...) success(i, ...) end)
    end
end

function success(i, data, status, headers)
    print(websites[i] .. " returned with a status of " .. status)
end

Thats it! @SkyTheCoder - Perfect and elegant!

I figured it was some combination of using the variable arg list identifier (…), but completely forgot about nesting it in a function!

Thank you sir! Very useful!