lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Michal Kottman wrote:
> - luacurl
> - Lua-cURL

It's confusing, isn't it, like with lua-curl news appearing
on the LuaCURL page, and the lua-curl package also being named
freepops-luacurl (note no hyphen between lua and curl), and its
debian package name being liblua5.1-curl0, and lua-curl also
existing capitalised as Lua-cURL, and being owned by Jürgen
on the lua-curl page but by Enrico on the luacurl page...
I hope I got that mostly right... Anyway, enough of that.

> I ended up with the following code in my utility module

They sure increased the size of that Download button :-)

Very useful, thank you!
(other interesting stuff, too - I'll have to check it all out.)

Regards,  Peter Billam

P.S. FWIW, my wget (still untested with the non-freepops) is now:

  function wget(url)
    local text = {}
    local function WriteMemoryCallback(a,b)
        -- luacurl and Lua-cURL friendly, see
        local s ; if type(a) == "string" then s = a else s = b end
        text[#text+1] = s
        return string.len(s)
    local c
    if then c = else c = curl.easy_init() end
    c:setopt(curl.OPT_URL, url)
    c:setopt(curl.OPT_WRITEFUNCTION, WriteMemoryCallback)
    c:setopt(curl.OPT_USERAGENT, "luacurl-agent/1.0")
    if curl.close then c:close() end
    return table.concat(text,'')
  end      (03) 6278 9410
"Was der Meister nicht kann,   vermöcht es der Knabe, hätt er
 ihm immer gehorcht?"   Siegfried to Mime, from Act 1 Scene 2