Passing Actions/Functions via exports


I don’t really know if this is possible, but I’m trying to invoke a lua export that involves a callback by passing an Action object.

Here is the code:


                void Callback(object x)
                    var info = (object[]) x;
                    Debug.WriteLine("Callback invoked!");

                    "GET", null, null, new Action<object>(Callback));


function httpRequest(url, method, info, headers, callback)
    Citizen.Trace('request received...\n')
    info = info or {}
    headers = headers or {}
    if not callback then
        Citizen.Trace('"callback" is nil\n')

    Citizen.Trace('sending out request\n')
    PerformHttpRequest(url, function(code, content, headers)
        Citizen.Trace('got callback, invoking action')
        local res = {code, content, headers}
    end, method, json.encode(info, headers))

It just keeps tracing ““callback” is nil” so I guess i’m doing something wrong here, or that it is not possible at all. If it’s not possible, is there a workaround?


UPDATE: No matter what I pass as the 5th argument, it seems to be relieved as nil? I don’t know if there is an argument limit in this or what…


ANOTHER UPDATE: When I pass everything as an array to the lua, then it works??? Is there an argument limit or a bug…


hm, might be the arguments in the middle being null is breaking something somewhere


Also, another thing (really only related to http), whenever I specify to post the server the server says that it’s receiving a “GET” request… Maybe another bug???