lune-org/lune

Add a REPL

Closed this issue · 10 comments

fewkz commented

Add a REPL so that we can run luau code with the lune runtime without having to create a script, would be useful for modifying Roblox place files interactively from the command line. Suggested this to Remodel before, but since Lune is a successor to Remodel, I'd love for Lune to have it rojo-rbx/remodel#90

fewkz commented

I'd just like to bump this because this is a really useful feature for a script runtime! I really wanted to use this for inspecting rbxm/rbxl files interactively from the command line instead of having to write and re-run a script again. I do hope it gets added

I'd be up to implement this whenever I can :)

As posted on Discord, I have created an intial Proof of Concept implementation here.

image

REPL has been implemented in #83 courtesy of @CompeyDev 🎉

I'm reopening this issue so that we can still track progress on important features such as context preservation

Mention me here once the core library allows for context preservation to be implemented, and I'll implement it accordingly.

In the meanwhile, I'll work on other issues :^)

The rewrite of the task scheduler and require (#88) now preserves context between calls to Lune::run, meaning the REPL will too. I'll go ahead and close this when that PR gets merged.

The rewrite of the task scheduler and require (#88) now preserves context between calls to Lune::run, meaning the REPL will too. I'll go ahead and close this when that PR gets merged.

Perfect! Is there a way for me to get the last declaration (such as a variable, or function declared) within the stack? This way I could get some value previews going...

Perfect! Is there a way for me to get the last declaration (such as a variable, or function declared) within the stack? This way I could get some value previews going...

Not as of right now, no, for this we would need some separate function which evaluates the given chunk and returns the lua value instead, and that also means our Lune lib would need to re-export mlua. I feel like this is probably a big enough thing to have it's own feature request / issue.

Alright, I'll create an issue for tracking's sake.

Created #92.