Re: [textadept] Loading a lua script

From: Robert <>
Date: Tue, 25 Jan 2011 22:40:55 +0100

On Sun, Jan 23, 2011 at 8:04 PM, mitchell <> wrote:
>> A script "test.lua" can now be run from the command line with
>> textadept --luaonly test.lua
> Cool! This can be rather useful.
>> Does anyone know how I could sandbox this that Textadept's modules
>> would not be part of the script's environment? I read a bit about
>> sandboxing and setfenv but haven't found a simple way yet. If this is
>> possible one could also use Textadept instead of the external Lua
>> interpreter in the run commands (if there is no Lua installed).
> I'm not sure that setfenv would work. Other than the obvious '[table] =
> nil', I don't know how this would be done since most of the initial state is
> populated in C.
> mitchell
Putting this directly in core/args.lua, like

if (arg[1] == '-l' or arg[1] == '--luaonly') then

args.register('-l', '--luaonly', 1, function() end, 'Load lua script and exit')

with local function luaonly as before there aren't that many things
loaded, so it would be less effort to delete them (or not necessary) -
plus starting the script here (before loading all other Textadept
modules) makes it feel as fast as using the standard Lua interpreter.

Received on Tue 25 Jan 2011 - 16:40:55 EST

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:59:08 EST