Sublime Forum

Live view/preview of Lua?

#1

I know that ST can do a browser view/preview that updates live as you edit HTML or CSS.

I also know that ST can be configured with a build system which runs Lua and displays its output in a console.

Is there a way to configure ST such that I can have a split pane with Lua on one side, and a live view/preview of the output of running that Lua code on the other side? Just like the HTML/CSS view, where as I edit Lua source code, I see the Lua output change?

0 Likes

#2

Would SublimeREPL be what you’re looking for? https://sublime.wbond.net/packages/SublimeREPL

0 Likes

#3

Sort of but not quite.

It seems that opens an REPL in another frame, and you can use keystrokes to copy/paste your code into it to run.

I want it to do that automatically every time I change a character in the code, so I can always see its output.

0 Likes

#4

Does anyone know what is the mechanism by which the live HTML/CSS views work? Like which APIs they use to launch them? Starting points for if one were to try to make a similar live view that wasn’t HTML/CSS?

0 Likes

#5

Take a look at this: sublime.wbond.net/packages/SublimeOnSaveBuild

There are actually a ton of plugins that will get you 90% of what you want, in various ways. Just search around for generic solutions, then make it specific to lua.

0 Likes

#6

That looks interesting, but I want to update the view whenever I type a character, not just when I save. This is what the web view does. I am wondering how I can replicate it, but with an output view that isn’t web.

0 Likes

#7

At lunch I did some reading about the plug-in API and managed to get a command invoked for every modification of the document. That’s a first step. Now I’m just working on making the command do what I want it to do, in another view. (Presumably that can be done.) So the docs are extremely sketchy but I am making progress on my dream.

0 Likes

#8

OK yesterday and today I hacked up a simple plug-in to do what I want.

Announcement/discussion:

Get it here:
github.com/mlepage/st3-live-view

0 Likes