Вы можете сделать это примерно так (но это не может быть на 100% правильно из-за того, что я не в своем уме, и это не включает обработку ошибок):
lua_getglobal(L, "modifyXml"); // push function on stack by name
lua_pushstring(L, xml); // push the xml string as parameter
lua_pcall(L, 1, 1, 0); // call the function with 1 parameter, 1 return value and no error handler
strcpy(xml, lua_tostring(L, -1)); // get the top of the stack as a string and copy it to xml
lua_pop(xml, 1); // remove the string from the stack
Вызванная функция lua моглавыглядеть так:
function modifyXml(xml)
-- do something with xml here
return xml
end