;ELC ;;; Compiled ;;; in Emacs version 26.3 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. ;;; This file does not contain utf-8 non-ASCII characters, ;;; and so can be loaded in Emacs versions earlier than 23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301!\210\300\302!\210\300\303!\210\304\305\306\"\207" [require ob org-macs cl-lib add-to-list org-babel-tangle-lang-exts ("lua" . "lua")] 3) (defvar org-babel-default-header-args:lua nil) (byte-code "\300\301\302\303\304DD\305\306\307\310\311\312\313\314\315& \210\300\316\302\303\317DD\320\312\313\306\307\310\321\314\322& \210\300\323\302\303\324DD\325\312\313\306\307\310\326\314\315& \210\300\327\302\303\330DD\331\312\313\306\307\310\332\314\322& \207" [custom-declare-variable org-babel-lua-command funcall function #[0 "\300\207" [#1="lua"] 1 #1#] "Name of the command for executing Lua code." :version "26.1" :package-version (Org . "8.3") :group org-babel :type string org-babel-lua-mode #[0 "\300\207" [lua-mode] 1] "Preferred lua mode for use in running lua interactively.\nThis will typically be `lua-mode'." (Org . "8.3") symbol org-babel-lua-hline-to #[0 "\300\207" [#2="None"] 1 #2#] "Replace hlines in incoming tables with this when translating to lua." (Org . "8.3") org-babel-lua-None-to #[0 "\300\207" [hline] 1] "Replace `None' in lua tables with this before returning." (Org . "8.3")] 12) #@117 Execute a block of Lua code with Babel. This function is called by `org-babel-execute-src-block'. (fn BODY PARAMS) (defalias 'org-babel-execute:lua #[514 "\300\301\236A!\302\236A\303\236A\211\304=\205?\205\305\236A\306\236A\307\203/\310\311\"\2020\312P\313 !#\314%\315\316\317 \236A\320\f\236A\"\316\321\f\236A\322 \236A\"#\207" [org-babel-lua-initiate-session :session :result-params :result-type value :return :preamble org-babel-expand-body:generic format "\nreturn %s" "" org-babel-variable-assignments:lua org-babel-lua-evaluate org-babel-reassemble-table org-babel-pick-name :colname-names :colnames :rowname-names :rownames] 16 (#$ . 1536)]) #@127 Prepare SESSION according to the header arguments in PARAMS. VARS contains resolved variable references. (fn SESSION PARAMS) (defalias 'org-babel-prep-session:lua #[514 "\301!\302!\303!\204\304\305\"\210\306 \307\310\311\312\313!\314\"\315$\216rq\210\212\316\317\307\320\321\312\313!\322\"\315\323%\"\210,\210\207" [comint-input-filter org-babel-lua-initiate-session org-babel-variable-assignments:lua org-babel-comint-buffer-livep error "Buffer %s does not exist or has no process" match-data make-byte-code 0 "\301\300\302\"\207" vconcat vector [set-match-data evaporate] 3 #[257 "\300\207" [nil] 2 "\n\n(fn INPUT)"] mapc 257 "\301\210\211c\210\302 \210\303\300!\207" [1 comint-send-input org-babel-comint-wait-for-output] "\n\n(fn VAR)"] 12 (#$ . 2226)]) #@51 Load BODY into SESSION. (fn SESSION BODY PARAMS) (defalias 'org-babel-load-session:lua #[771 "\300 \301\302\303\304\305!\306\"\307$\216\310\"r\211q\210\311\312p!!b\210\313!c\210)\211\262)\207" [current-window-configuration make-byte-code 0 "\301\300!\207" vconcat vector [set-window-configuration] 2 org-babel-prep-session:lua process-mark get-buffer-process org-babel-chomp] 10 (#$ . 3005)]) #@79 Return a list of Lua statements assigning the block's variables. (fn PARAMS) (defalias 'org-babel-variable-assignments:lua #[257 "\300\301\302!\"\207" [mapcar #[257 "\300\301@\302A!#\207" [format "%s=%s" org-babel-lua-var-to-lua] 6 "\n\n(fn PAIR)"] org-babel--get-vars] 5 (#$ . 3410)]) #@156 Convert an elisp value to a lua variable. Convert an elisp value, VAR, into a string of lua source code specifying a variable of the same value. (fn VAR) (defalias 'org-babel-lua-var-to-lua #[257 "\211<\2038\211G\301U\203\211@<\204\302@!\207\211G\303U\203/\211@<\204/\304@!\305\302A!Q\207\306\307\302\310#\311Q\207\211\312=\203@\207\313;\203Q\314\315\"\203Q\316\202R\317;\203]\304!\202^\"\207" [org-babel-lua-hline-to 1 org-babel-lua-var-to-lua 2 substring-no-properties "=" "{" mapconcat ", " "}" hline format string-match "[\n ]" "[=[%s]=]" "%S"] 6 (#$ . 3707)]) #@192 Convert RESULTS into an appropriate elisp value. If the results look like a list or tuple, then convert them into an Emacs-lisp table, otherwise return the results as a string. (fn RESULTS) (defalias 'org-babel-lua-table-or-string #[257 "\300!\211<\203\301\302\"\202\211\207" [org-babel-script-escape mapcar #[257 "\211\301=\203\207\207" [org-babel-lua-None-to None] 3 "\n\n(fn EL)"]] 5 (#$ . 4303)]) (defvar org-babel-lua-buffers '((:default . "*Lua*"))) #@58 Return the buffer associated with SESSION. (fn SESSION) (defalias 'org-babel-lua-session-buffer #[257 "\301\"A\207" [org-babel-lua-buffers assoc] 4 (#$ . 4775)]) #@16 (fn SESSION) (defalias 'org-babel-lua-with-earmuffs #[257 "\211;\203 \211\202 \300\301\"\211\302\303O\304\230\203%\211GS\305O\304\230\203%\211\202)\300\306\"\207" [format "%s" 0 1 "*" nil "*%s*"] 5 (#$ . 4946)]) #@16 (fn SESSION) (defalias 'org-babel-lua-without-earmuffs #[257 "\211;\203 \211\202 \300\301\"\211\302\303O\304\230\203*\211GS\305O\304\230\203*\211\303GSO\202+\211\207" [format "%s" 0 1 "*" nil] 5 (#$ . 5174)]) #@156 Initiate a lua session. If there is not a current inferior-process-buffer in SESSION then create. Return the initialized session. (fn &optional SESSION) (defalias 'org-babel-lua-initiate-session-by-key #[256 "\303 \304\305\306\307\310!\311\"\312$\216\203\313!\202\314\315!\316=\203P\317\320!\203P\211\203<\321!\203<\322\323\324\325!#\202A\326\327!P\211\320 \210\330!\262)\210\202T\331\332!\210B\333\n\"B\266\202)\207" [org-babel-lua-mode lua-which-bufname org-babel-lua-buffers current-window-configuration make-byte-code 0 "\301\300!\207" vconcat vector [set-window-configuration] 2 intern :default org-babel-lua-session-buffer lua-mode fboundp lua-start-process buffer-live-p replace-regexp-in-string "^\\*\\([^*]+\\)\\*$" "\\1" buffer-name "Lua-" symbol-name org-babel-lua-with-earmuffs error "No function available for running an inferior Lua" assq-delete-all] 9 (#$ . 5400)]) #@84 Create a session named SESSION according to PARAMS. (fn &optional SESSION PARAMS) (defalias 'org-babel-lua-initiate-session #[512 "\300\230?\205\301\302!\210\303\304!!\207" ["none" error "Sessions currently not supported, work in progress" org-babel-lua-session-buffer org-babel-lua-initiate-session-by-key] 5 (#$ . 6315)]) #@53 A string to indicate that evaluation has completed. (defvar org-babel-lua-eoe-indicator "--eoe" (#$ . 6650)) (defvar org-babel-lua-wrapper-method "\nfunction main()\n%s\nend\n\nfd=io.open(\"%s\", \"w\")\nfd:write( main() )\nfd:close()") (defvar org-babel-lua-pp-wrapper-method "\n-- table to string\nfunction t2s(t, indent)\n if indent == nil then\n indent = \"\"\n end\n if type(t) == \"table\" then\n ts = \"\"\n for k,v in pairs(t) do\n if type(v) == \"table\" then\n ts = ts .. indent .. t2s(k,indent .. \" \") .. \" = \\n\" ..\n t2s(v, indent .. \" \")\n else\n ts = ts .. indent .. t2s(k,indent .. \" \") .. \" = \" ..\n t2s(v, indent .. \" \") .. \"\\n\"\n end\n end\n return ts\n else\n return tostring(t)\n end\nend\n\n\nfunction main()\n%s\nend\n\nfd=io.open(\"%s\", \"w\")\nfd:write(t2s(main()))\nfd:close()") #@92 Evaluate BODY as Lua code. (fn SESSION BODY &optional RESULT-TYPE RESULT-PARAMS PREAMBLE) (defalias 'org-babel-lua-evaluate #[1282 "\203 \300$\207\301$\207" [org-babel-lua-evaluate-session org-babel-lua-evaluate-external-process] 10 (#$ . 7595)]) #@262 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 elisp. (fn BODY &optional RESULT-TYPE RESULT-PARAMS PREAMBLE) (defalias 'org-babel-lua-evaluate-external-process #[1025 "\303=\203\304\211\205\305Q\"\202e\306=\203d\307\310!\304\211\205&\305\311\312\235\2032 \2023\n\313\314\315\316\317\320\203C\321\202D\322\323\320\324\323##\266\202!\325\"\305#\326\327\"#Q\"\210\330!\262\202e\317\331\235?\205\313\332\235\204\257\333\235\204\257\334\235\204\257\335\235\204\257\312\235\204\257\336\235\204\257\337\235\204\251\340\235\204\251\341\235\204\251\342\235\203\263\343\235\204\263\202\313\344\317\320\203\277\321\202\300\322\323\320\324\323##\266\202!\262\207" [org-babel-lua-command org-babel-lua-pp-wrapper-method org-babel-lua-wrapper-method output org-babel-eval "\n" value org-babel-temp-file "lua-" format "pp" mapconcat #[257 "\300\301\"\207" [format " %s"] 4 "\n\n(fn LINE)"] split-string org-remove-indentation nil replace-regexp-in-string "\\`\\([ ]*\n\\)+" "\\`[ \n ]+" "" "[ \n ]+\\'" "[ \n]" org-babel-process-file-name noquote org-babel-eval-read-file "none" "scalar" "verbatim" "html" "code" "file" "output" "raw" "org" "drawer" "table" org-babel-lua-table-or-string] 24 (#$ . 7860)]) #@263 Pass BODY to the Lua process in SESSION. 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 elisp. (fn SESSION BODY &optional RESULT-TYPE RESULT-PARAMS) (defalias 'org-babel-lua-evaluate-session #[1026 "\306\307\310\311=\203\310\312\313\314\315\n!\204\316\317 \"\210\320 \321\322\323\324\325!\326\"\327$\216r\nq\210\212\330\331C\321\332\333\324\325!\334\"\335\336% B\337\340\341p!!b\210`d{\262|\266  \"\210 \210 \210\nc\210 \210 b\210\212\342\343\n!\337\344#\205~\342\f\337\344#)\204\213\345\341p!!\210\202k\340\341p!!b\210\211c\210 \203\266\346\347\350\351\343\206\245\331!#\242\"\203\266\211\242\322\225\337O\240\210\352\242\f\")\266\202,\262\353\"\350#\202z\354=\203y\355\356!\315!\204\336\316\317 \"\210\320 \321\322\323\324\325!\357\"\327$\216rq\210\212\360\331C\321\332\333\324\325!\334\"\335\336% B\337\340\341p!!b\210`d{\262|\266\337 \"\210\361 \235#\210 \210 \210\nc\210 \210) b\210\212\342\343\n!\337\344#\205O\342\f\337\344#)\204\\\345\341p!!\210\202<\340\341p!!b\210\211c\210\352\242\f\"\210)\266,\210\362!\262\202z\337\n\363\364O\230?\205\331\365\235?\205\327\366\235\204\316\367\235\204\316\370\235\204\316\371\235\204\316\361\235\204\316\372\235\204\316\373\235\204\310\374\235\204\310\375\235\204\310\376\235\203\322\377\235\204\322\202\327\201@!\262\207" [comint-input-filter comint-output-filter-functions org-babel-lua-eoe-indicator comint-last-input-end comint-prompt-regexp comint-process-echoes #[0 "\300\301\302\"\210\303\304\305\"\207" [comint-send-input nil t sleep-for 0 5] 3] #[771 "\300\301\302\303\304\305!\306\"\307\310%\203\311\312\313\314\"PD\202'\315\316\313\314\"\"C\"\207" [mapc make-byte-code 257 "\211c\210\300 \207" vconcat vector #1=[] 2 "\n\n(fn STATEMENT)" "-- table to string\nfunction t2s(t, indent)\n if indent == nil then\n indent = \"\"\n end\n if type(t) == \"table\" then\n ts = \"\"\n for k,v in pairs(t) do\n if type(v) == \"table\" then\n ts = ts .. indent .. t2s(k,indent .. \" \") .. \" = \\n\" ..\n t2s(v, indent .. \" \")\n else\n ts = ts .. indent .. t2s(k,indent .. \" \") .. \" = \" ..\n t2s(v, indent .. \" \") .. \"\\n\"\n end\n end\n return ts\n else\n return tostring(t)\n end\nend\n" "fd:write(_))\nfd:close()" org-babel-process-file-name noquote format "fd=io.open(\"%s\", \"w\")\nfd:write( _ )\nfd:close()"] 10 "\n\n(fn SEND-WAIT TMP-FILE PP)"] #[514 "\300\301\302\303\304\305!\306\"\307\310%\311\312\"\"\210 \207" [mapc make-byte-code 257 "\211c\210\300 \207" vconcat vector #1# 2 "\n\n(fn LINE)" split-string "[ \n]"] 9 "\n\n(fn SEND-WAIT BODY)"] output mapconcat org-trim butlast org-babel-comint-buffer-livep error "Buffer %s does not exist or has no process" match-data make-byte-code 0 "\301\300\302\"\207" vconcat vector [set-match-data evaporate] 3 #[257 "\300\207" [nil] 2 "\n\n(fn INPUT)"] "" 257 "\300\211\242P\240\207" #1# 4 "\n\n(fn TEXT)" nil process-mark get-buffer-process re-search-forward regexp-quote t accept-process-output string-match replace-regexp-in-string "\n" "[ \n]+" split-string 2 value org-babel-temp-file "lua-" [set-match-data evaporate] #[257 "\300\207" [nil] 2 "\n\n(fn INPUT)"] "pp" org-babel-eval-read-file 1 -1 "none" "scalar" "verbatim" "html" "code" "file" "output" "raw" "org" "drawer" "table" org-babel-lua-table-or-string] 19 (#$ . 9279)]) #@47 Strip 's from around Lua string. (fn STRING) (defalias 'org-babel-lua-read-string #[257 "\300\301\211#\207" [org-unbracket-string "'"] 5 (#$ . 12890)]) (provide 'ob-lua)