From 1e0661c37bf40189c91e935811296b9919804075 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 11 Feb 2013 16:38:18 -0500 Subject: Added command line switches for running Lua code on startup. --- modules/textadept/command_entry.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'modules/textadept/command_entry.lua') diff --git a/modules/textadept/command_entry.lua b/modules/textadept/command_entry.lua index d3d2d1ea..31e3cff1 100644 --- a/modules/textadept/command_entry.lua +++ b/modules/textadept/command_entry.lua @@ -87,6 +87,14 @@ events.connect(events.COMMAND_ENTRY_KEYPRESS, function(code) end end) +-- Executes Lua code on startup. +local function execute(command) + local f, err = load(command, nil, 'bt', env) + if err then error(err) end + f() +end +args.register('-e', '--execute', 1, execute, 'Execute Lua code') + --[[ The function below is a Lua C function. --- -- cgit v1.2.3