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 = {"", ""}
    for i = 1, #websites do
        http.request(websites[i], function(...) success(i, ...) end)

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

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!