Interactive Lua Prompt

From: SteveD <>
Date: Mon, 28 Mar 2011 00:22:17 -0700 (PDT)

Hi all,

First post, and as usual, coming in with all feet kicking.


This is a cool way to explore Textadept using interactive Lua, unlike
single-shot F2 commands.

It is pretty straightforward, no Lua magic except print <- gui.print.

Just go F2 lua()

However, I did need to override the default implementation of

1 captures nils etc in the varargs
2 converts everything to strings so that table.concat does not freak
3 leaves the caret after the inserted text
4 implements gui.write() so I could put out the Lua prompt.

The first two are needed for situations like gui.print('hello',nil,{})
- there is a nil arg, which will mess up the size of the args table,
and {}, which will make table.concat() complain bitterly. This
implementation is pretty consistent with the behaviour of _G.print().

Although generally I like auto-pair completion, it does mess a bit
with the interactive prompt - would be useful if this feature could be
disabled selectively for message buffers. (Comment out this line if
you want to see the issue)

Interesting behaviour: if Textadept has initially just an Untitled
buffer, then any gui.print() will bring up a message view and split -
but in this case both views will point to the new message buffer.
Easy to reproduce, just an empty session and F2 print 'hello'. Not
sure if it's a big issue, but it is odd.

steve d.
Received on Mon 28 Mar 2011 - 03:22:17 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 12:03:39 EST