Kalgoorlie Retro Docs

Documentation for the Kalgoorlie Retro BBS, its games and servers

User Tools

Site Tools


lanternterminal:lua

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
lanternterminal:lua [2026-11-08 03:15] – Update Lantern Terminal guides for 0.3.0 slatermlanternterminal:lua [2026-11-08 08:49] (current) – Update Lantern Terminal guides for 0.4.0 slaterm
Line 19: Line 19:
   * Tab properties: ''id'', ''Caption'' (writable), ''Index'' (one-based), ''Screen'', ''Session''.   * Tab properties: ''id'', ''Caption'' (writable), ''Index'' (one-based), ''Screen'', ''Session''.
   * Tab methods: ''Activate()'', ''Clone()'', ''Close()'', ''ConnectSftp()'', ''ResetCaption()''. Clone and SFTP return a new tab.   * Tab methods: ''Activate()'', ''Clone()'', ''Close()'', ''ConnectSftp()'', ''ResetCaption()''. Clone and SFTP return a new tab.
 +  * Zmodem: ''tab:ZmodemUpload({path, ...})'' queues files that are sent when the host starts its Zmodem receiver (returns the number queued), ''tab:ZmodemCancel()'' stops a transfer, ''tab:ZmodemActive()'' is true while one runs. Downloads start by themselves.
  
 Prefer ''GetScriptTab()'' for automation. ''GetActiveTab()'' deliberately targets the tab currently in focus. Prefer ''GetScriptTab()'' for automation. ''GetActiveTab()'' deliberately targets the tab currently in focus.
Line 63: Line 64:
  
 Scripts execute with your user privileges, including standard Lua filesystem/process access. Run trusted code and review recordings for secrets. Do not embed passwords or key passphrases. The worker is a separate cancellable process, not a security sandbox. Scripts execute with your user privileges, including standard Lua filesystem/process access. Run trusted code and review recordings for secrets. Do not embed passwords or key passphrases. The worker is a separate cancellable process, not a security sandbox.
 +
 +===== Scripts written for SyncTERM-Lua =====
 +
 +Scripts written for the SyncTERM 1.9 Lua scripting fork run unchanged. The first time a script uses one of its global names (''send'', ''expect'', ''screen'', ''regex'', ''bbs'' and so on), Lantern loads a compatibility layer that provides them on top of the API above. Ordinary Lantern scripts are not affected, and the same file still runs in SyncTERM.
 +
 +Supported: ''expect'', ''expect_pattern'', ''expect_regex'' (PCRE2), ''must_expect'', ''waitfor'', ''readline'', ''quiet'', ''sleep'', ''idle'', ''set_timeout'', ''on''/''off'' triggers, ''send'', ''sendln'', ''screen'', ''screen_size'', ''cursor'', ''buffer'', ''clear'', ''raw'', ''connected'', ''disconnect'', ''quit'', ''now'', ''message'', ''input'', ''confirm'', ''log''/''print'', ''regex.find''/''regex.match'', the ''before''/''matched'' globals, ''script_path'' and the ''bbs'' table. They behave as in SyncTERM: received text has ANSI codes and stray control characters removed before matching, ''expect'' uses up text up to its match, ''quiet(s)'' waits at least ''s'' seconds of silence counted from the call, and the script stops when the connection closes.
 +
 +  * ''bbs.user'', ''bbs.name'', ''bbs.address'', ''bbs.port'' and ''bbs.conn_type'' come from the session (Username, name, Hostname, Port, Protocol: ''Telnet'', ''RLogin'', ''SSH2'', ''Raw TCP''). ''bbs.password'' is always ''nil''.
 +  * Set the session's **Terminal → Appearance → Character encoding** to **CP437** for BBSes. The script then receives the BBS's original CP437 bytes, exactly as in SyncTERM.
 +  * A script run as the session's logon script, or with ''--script'' when opening a session, sees everything received since the connection started, like a SyncTERM dialing-directory script. A script started with **Script → Run** mid-session starts with an empty buffer, like SyncTERM's script hotkey.
 +  * ''log'' and ''print'' write to the Activity pane. ''message'', ''input'' and ''confirm'' show dialogs. For unattended runs, set ''syncterm_answers = {confirm = {...}, input = {...}, message = {...}}'' before the first SyncTERM call; each question takes the next answer.
  
 ===== Recording and diagnostics ===== ===== Recording and diagnostics =====
lanternterminal/lua.1794107737.txt.gz · Last modified: by slaterm