In Lua, unlike in JavaScript, you don't need to use closures for async programming most of the time.
-- SendAll
-- Start sending a message on connection [c]
-- Close when done.
function SendAll(c, msg)
local n=0
while n<#msg do
yield()
n=n + c.fd:send(msg, n)
end
c.fd:close()
yield('close') -- just for kicks
end