You can pass text to vim using stdin (for example, echo 'Hello, world!' | vim -), but I'm not sure how to submit edited results to stdout. So, the first part of the solution in lua:
local vim = io.popen('vim -', 'w')
vim:write('Hello, world!')
, , ?