Function: lua-send-region

lua-send-region is an interactive and byte-compiled function defined in lua-mode.el.gz.

Signature

(lua-send-region START END)

Documentation

Send region between START and END to the inferior Lua process.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/lua-mode.el.gz
(defun lua-send-region (start end)
  "Send region between START and END to the inferior Lua process."
  (interactive "r")
  (setq start (lua-maybe-skip-shebang-line start))
  (let* ((lineno (line-number-at-pos start))
         (lua-file (or (buffer-file-name) (buffer-name)))
         (region-str (buffer-substring-no-properties start end))
         (command
          ;; Print empty line before executing the code so that the
          ;; first line of output doesn't end up on the same line as
          ;; current prompt.
          (format "print(''); luamode_loadstring(%s, %s, %s);\n"
                  (lua-make-lua-string region-str)
                  (lua-make-lua-string lua-file)
                  lineno)))
    (lua-send-string command)
    (when lua-always-show (lua-show-process-buffer))))