Function: org-babel-lua-evaluate

org-babel-lua-evaluate is a byte-compiled function defined in ob-lua.el.gz.

Signature

(org-babel-lua-evaluate BODY &optional RESULT-TYPE RESULT-PARAMS PREAMBLE)

Documentation

Evaluate BODY in external Lua process.

If RESULT-TYPE equals output then return standard output as a string. If RESULT-TYPE equals value then return the value of the last statement in BODY, as Emacs Lisp. RESULT-PARAMS list all the :result header arg parameters. PREAMBLE string is appended to BODY.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ob-lua.el.gz
(defun org-babel-lua-evaluate
    (body &optional result-type result-params preamble)
  "Evaluate BODY in external Lua process.
If RESULT-TYPE equals `output' then return standard output as a
string.  If RESULT-TYPE equals `value' then return the value of the
last statement in BODY, as Emacs Lisp.
RESULT-PARAMS list all the :result header arg parameters.
PREAMBLE string is appended to BODY."
  (let ((raw
         (pcase result-type
           (`output (org-babel-eval org-babel-lua-command
				    (concat preamble (and preamble "\n")
					    body)))
           (`value (let ((tmp-file (org-babel-temp-file "lua-")))
		     (org-babel-eval
		      org-babel-lua-command
		      (concat
		       preamble (and preamble "\n")
		       (format
                        org-babel-lua-wrapper-method
			(mapconcat
			 (lambda (line) (format "\t%s" line))
			 (split-string
			  (org-remove-indentation
			   (org-trim body))
			  "[\r\n]")
                         "\n")
                        (if (member "pp" result-params)
                            "true" "false")
                        org-babel-lua-multiple-values-separator
			(org-babel-process-file-name tmp-file 'noquote))))
		     (org-babel-eval-read-file tmp-file))))))
    (org-babel-result-cond result-params
      raw
      (org-babel-lua-table-or-string (org-trim raw)))))