1

I would like to fetch the body of an HTTPS response into a Lua variable using lcURL. Here is what I have so far, but it does not work:

local cURL = require("lcurl");

function x(str)
    print(x)
end

curl = cURL.easy{url='https://devrant.com', writefunction=x}:perform():close()

I have found lots of examples of how to write them into a file, but not into a variable.

My output is:

function: 0x5594bfd310f0
function: 0x5594bfd310f0

1 Answer 1

2

I swear I'm not an idiot, but my behavior in this post is clear evidence otherwise. I'm printing x. FML. The solution is to print str

Sign up to request clarification or add additional context in comments.

1 Comment

I use t={} handle:setopt_writefunction(table.insert, t) handle:perform() result = table.concat(t)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.