\documentclass[11pt]{article}
\usepackage{luacode}
\usepackage{booktabs}
\usepackage{filecontents}

\LuaCodeDebugOn

\begin{filecontents*}{ltxorg.el}
(require 'org)
(defun my-org-2-ltx (str)
  (string-trim (org-export-string-as str 'latex t)))
\end{filecontents*}

\begin{filecontents*}{ltxorg.sh}
#!/bin/bash
ARG="$1"
emacs -batch -l ltxorg.el --eval "(princ (my-org-2-ltx \"$ARG\"))"
\end{filecontents*}

\begin{luacode*}
org = [[]]
function org_output (arg)
local x = io.popen("chmod +x ltxorg.sh && ./ltxorg.sh '" .. org .. "' > /tmp/temp.tex")
x:close ()
y = "\\input{/tmp/temp.tex}"
tex.print(y)
end
\end{luacode*}

\begin{document}

\begin{luacode*}

org = [[

* Section

/Lorem ipsum dolor/

*Lorem ipsum dolor*

#+caption: Lorem ipsum dolor
#+ATTR_LaTeX: :booktabs t
|-------------+-------------+-------------|
| lorem       | ipsum       | dolor       |
|-------------+-------------+-------------|
| lorem ipsum | lorem ipsum | lorem ipsum |
| lorem ipsum | lorem ipsum | lorem ipsum |
| lorem ipsum | lorem ipsum | lorem ipsum |
| lorem ipsum | lorem ipsum | lorem ipsum |
|-------------+-------------+-------------|
| lorem ipsum | lorem ipsum | lorem ipsum |
|-------------+-------------+-------------|

]]

org_output()

\end{luacode*}

\begin{luacode*}

 org = [[

  * Section

  - Lorem ipsum dolor
  - Lorem ipsum dolor
  - Lorem ipsum dolor
   - Lorem ipsum dolor
   - Lorem ipsum dolor
  - Lorem ipsum dolor
]]

org_output()

\end{luacode*}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
