Skip to content

Application Level Scripting Cleanup - #1188

Merged
mfisher31 merged 5 commits into
mainfrom
high-level-scripting-cleanup
Sep 23, 2026
Merged

mfisher31 merged 5 commits into
mainfrom
high-level-scripting-cleanup

Conversation

@mfisher31

Copy link
Copy Markdown
Member

No description provided.

@mfisher31 mfisher31 changed the title docs: plans: update app level scripting plans Application Level Scripting Basics Sep 22, 2026
@mfisher31
mfisher31 force-pushed the high-level-scripting-cleanup branch from 88a3951 to 26d2cd0 Compare September 23, 2026 01:55
Phase 0 step 1 of docs/plans/session-scripts.md. Fixes what the scripting
audit found broken on the app side and removes what was never wired up.

Console
- Implement the declared-but-missing ScriptingEngine::execute: expression
  probe, protected call with a debug.traceback handler, UTF-8 byte length,
  message-thread assert, errors returned as a juce::Result.
- Give the engine a persistent console environment and history so state
  survives closing and reopening the console view.
- Load the console prelude from the compiled binary data instead of the
  filesystem search path, which never resolved in dev builds. el.script.exec
  now raises on load failure instead of returning the message.
- Stop swapping the global print per eval; override os.exit on a
  console-local os table rather than the global one.
- Marshal Log messages to the message thread and guard the print buffer.
- Fix the persisted console view name, accept the old misspelling, add F3.

Bindings
- Add Context:commands() to el.Context, resolved per call through the
  services, so el.command's existing Context.instance():commands() works.
- Fix el.command calling a nonexistent strings.valid.
- Make el/session.lua resolve the session per call instead of caching it.
- Fix the missing comma in widget.hpp __props.

DSP scripts
- DSPScript::process now uses lua_pcall. Lua is built as C, so an error in a
  script's process had no handler and aborted the app. The script is disabled
  and the message kept instead. Restore the stack top after the call.
- init/prepare/release go through the same protected path and return false
  on error; getLastError() exposes the message.
- Make DSPScript::validate functional: instantiate in a scratch state and run
  init/prepare, four process cycles with audio and MIDI, and release; reject
  scripts that raise or produce non-finite output.

Cleanup
- Remove ScriptingEngine::L, State::builtins, EL_LUA_SPATH,
  Impl::scanDefaultLoctaion, scripts/commands.lua, the #if 0 vector.c, and
  two orphaned test snippets. addPackage and its searcher stay: both
  searchers coexist and extensions will register modules through it.
- Note ScriptManager as test-only until extensions land; loosen the
  hard-coded script count in ScriptManagerTest to a lower bound.

Docs
- CLAUDE.md: add a Lua Bindings section (single entry point via el.Context,
  bind on the owner and resolve per call, no shortcut globals).
- Plans: record the addPackage correction, the View-script compatibility
  pass, the reordered work list, and keep ScriptInstance/ScriptSource.

Tests: new ConsoleTests suite; DSPScriptTest gains validate and
process-error coverage.
@mfisher31
mfisher31 marked this pull request as ready for review September 23, 2026 04:02
@mfisher31 mfisher31 changed the title Application Level Scripting Basics Application Level Scripting Cleanup Sep 23, 2026
@mfisher31
mfisher31 merged commit b9d9edc into main Sep 23, 2026
6 checks passed
@mfisher31
mfisher31 deleted the high-level-scripting-cleanup branch September 23, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant