Class RuntimeContext
This context owns engine function registration, object lifecycle tracking, and include resolution configuration so the compiler and runtime no longer depend on global singletons.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionRuntimeContext(IncludeResolver includeResolver) RuntimeContext(IncludeResolver includeResolver, EfunRegistry efunRegistry) -
Method Summary
Modifier and TypeMethodDescriptionintappendMudlibText(String path, Object text) voidbindEntityAlias(Object object, Object namespace, Object alias) voidbindPlayerSession(String sessionId, String remoteAddress, Consumer<String> sessionOutputSink) voidbindSession(String sessionId, Object persona, String remoteAddress, Consumer<String> sessionOutputSink) voidbindSession(String sessionId, Object persona, String remoteAddress, Consumer<String> sessionOutputSink, MudlibProjection mudlibProjection) voidbindSessionProtocolSink(Object persona, BiConsumer<String, String> protocolOutputSink) Installs the host transport sink used for out-of-band messages to an interactive persona.intcancelDeferredCallback(String methodName) Cancels the earliest pending callback for the named method on the current object.booleancapturedSessionInputNoEcho(Object persona) voidcaptureSessionInput(String methodName, boolean noEcho, Object... extraArgs) Captures the next line of interactive session input for the current output persona.voidclearCommandActions(Object actor) voidvoidcloneObject(String sourcePath) voidconfigureCommandAliases(Object aliases) Installs host-level command aliases used before LPC action lookup.intcopyMudlibText(String source, String destination) intcreateMudlibDirectory(String path) intdbClose(int handle) Closes a JVMud database handle.intOpens a configured JDBC database connection and returns a JVMud database handle.intOpens a JDBC database connection with mudlib-supplied credentials.dbError(int handle) Returns the last JDBC error for a JVMud database handle, or LPC false when clear.Escapes a string for interpolation into mudlib-generated SQL.intExecutes SQL for a JVMud database handle and returns the handle on success.dbFetch(int handle) Fetches one row from a JVMud database handle's current result cursor.Returns the currently open JVMud database handles.deliverCapturedSessionInput(Object persona, String line) Delivers one line to a pendinginput_to()callback while preserving that pending state for runtime queries made during the callback.voiddestructObject(Object object) voiddisableEntityCommands(Object object) dispatchCommand(Object actor, String commandLine) voidemitPerceivable(Object emitter, Object value) voidemitPerceivableAt(Object location, Object value) voidemitPerceivableExcept(Object emitter, Object value, Object excluded) voidenableEntityCommands(Object object) engineFunctionName(String mudlibName) intentityCommandsEnabled(Object object) intentityHasAlias(Object object, Object namespace) booleanentityTranslucent(Object object) environment(Object object) findEntityAlias(Object namespace, Object alias) firstInventory(Object container) booleanhasCapturedSessionInput(Object persona) booleanhasObjectMethod(Object target, String methodName, int arity) Reports whether a generated LPC object exposes a public method with the requested arity.inheritedPrograms(Object object) Returns the LPC program path and transitive inherited program paths for a generated LPC object.invokeEfun(String name, int arity, Object[] args) Invokes a mudlib-visible function through the active compatibility boundary.invokeObject(Object target, String methodName, Object... args) invokeOptionalObject(Object target, String methodName, Object... args) booleanisDestroyedObject(Object object) booleanisInteractive(Object user) Returns true when the supplied LPC object is currently bound to an active JVMud session.booleanisSessionProtocolEnabled(Object persona, String protocol) Returns whether a client protocol has been negotiated for an interactive persona.listMudlibPaths(String path, int flags) Lists mudlib-rooted paths using an LP-style flag word.loadOrGetObject(String name) lpcObjectForSession(String sessionId) Returns the LPC object projection currently attached to a host session, when one exists.voidmoveObject(Object object, Object destination) Moves one LPC object and immediately starts the destination interaction scope for a connected command actor.nextInventory(Object object) intnotifyCommandFailure(Object message) Records the command failure text to display when no command action accepts the line.objects()Returns the parser profile used for runtime-loaded mudlib source.personaRecordForProjection(Object persona) playerRecordForSession(String sessionId) voidvoidpushCurrentObject(Object object) intqueryIpNumber(Object persona) readMudlibJson(String path) Parses an ordinary JSON file rooted inside the mudlib.readMudlibJsonArray(String path, String pointer, int offset, int count) Reads a bounded slice from a JSON array inside a mudlib-rooted file.readMudlibText(String path) booleanrebindSessionLpcObject(Object newObject, Object oldObject) Rebinds an existing host session from one LPC object projection to another.voidregisterEfun(Efun efun) voidregisterInMemoryObjectSource(String objectPath, String source, String displayPath) Registers source text for an in-memory LPC object that may later serve as a global helper.voidregisterObject(String name, Object object) Binds an engine object to a mudlib object path.voidregisterVerb(String verb) voidregisterVerb(String verb, boolean prefixMatch) Registers a pending LPC command action for the active command actor.voidrememberActionMethod(String methodName) intremoveCommandActions(Object actor, Object handler) Removes command actions owned by a handler from one actor's current command table.intremoveMudlibDirectory(String path) intremoveMudlibText(String path) intrenameMudlibText(String source, String destination) resolveEfun(String name, int arity) resolveEngineEfun(String name, int arity) Resolves an engine efun without consulting mudlib compatibility functions.intvoidrunWithCurrentObject(Object object, Runnable action) intvoidscheduleDeferredCallback(String methodName, int delaySeconds, Object... args) Schedules a one-shot callback on the current object without replacing other callbacks that happen to target the same method.voidscheduleRecurringTick(int enabled, int intervalSeconds) booleansendSessionProtocolMessage(Object persona, String protocol, String message) Sends one already encoded out-of-band message through a negotiated client protocol.sessionRecord(String sessionId) voidsetEntityTranslucent(Object object, boolean translucent) voidsetIncludeResolver(IncludeResolver includeResolver) intsetLight(int delta) voidsetLPCObjectStateRestorer(BiFunction<String, Object, Integer> lpcObjectStateRestorer) voidsetLPCObjectStateSaver(BiFunction<String, Object, Integer> lpcObjectStateSaver) voidsetMfunObjectPath(String mfunObjectPath) Deprecated.voidsetMudlibBoundary(MudlibBoundary mudlibBoundary) Sets active mudlib boundary metadata for generated-code helpers and compatibility lookup.voidsetMudlibDirectoryCreator(Function<String, Integer> mudlibDirectoryCreator) voidsetMudlibDirectoryRemover(Function<String, Integer> mudlibDirectoryRemover) voidsetMudlibJsonArrayReader(MudlibJsonArrayReader mudlibJsonArrayReader) Sets the host callback used for bounded, structural reads of mudlib JSON arrays.voidsetMudlibJsonReader(Function<String, Object> mudlibJsonReader) Sets the host callback used to parse mudlib-owned JSON files.voidsetMudlibPathLister(BiFunction<String, Integer, Object> mudlibPathLister) Sets the host callback used by file-listing efuns to enumerate mudlib-rooted paths.voidsetMudlibTextAppender(BiFunction<String, Object, Integer> mudlibTextAppender) voidsetMudlibTextCopier(BiFunction<String, String, Integer> mudlibTextCopier) voidsetMudlibTextReader(Function<String, Object> mudlibTextReader) voidsetMudlibTextRemover(Function<String, Integer> mudlibTextRemover) voidsetMudlibTextRenamer(BiFunction<String, String, Integer> mudlibTextRenamer) voidsetObjectDestructionRequestedHandler(Function<Object, Object> objectDestructionRequestedHandler) voidsetObjectFactory(Function<String, Object> objectFactory) voidsetObjectLoader(Function<String, Object> objectLoader) voidsetOutputSink(Consumer<String> outputSink) voidsetParserOptions(ParserOptions parserOptions) Selects the parser profile used for runtime-loaded mudlib source.voidsetPlayerTransferHandler(BiFunction<Object, String, Integer> playerTransferHandler) voidsetScheduler(WorldScheduler scheduler) voidsetSessionProtocolEnabled(Object persona, String protocol, boolean enabled) Records whether a negotiated client protocol is active for an interactive persona.voidsetTimedRuntimeErrorHandler(RuntimeContext.TimedRuntimeErrorHandler timedRuntimeErrorHandler) voidsetWorldProjection(MudlibWorldProjection worldProjection) Selects the native world projection that owns mudlib containment state.voidtouchPersona(Object persona) inttransferCurrentPlayerToGame(String gameId) voidunbindSession(String sessionId) users()Returns mudlib-facing interactive personas that are in normal command mode.<T> TwithCommandActor(Object actor, Supplier<T> action) <T> TwithCurrentObject(Object object, Supplier<T> action) <T> TwithScopedCommandRegistration(Supplier<T> action) Returns the native world projection currently used for LPC containment operations.voidWrites text to the current execution recipient, or to the transcript in detached contexts.voidwriteToLpcObject(Object target, Object value) Writes text only to the target object's bound session.booleanwriteToPersona(PersonaId personaId, Object value) Writes engine gameplay text to the bound Session for one Persona.booleanwriteToPlayer(PlayerId playerId, Object value) Writes engine control-plane text to all active Sessions for one Player.booleanwriteToSession(SessionId sessionId, Object value) Writes engine control-plane or transport text to one bound Session.
-
Constructor Details
-
RuntimeContext
-
RuntimeContext
-
-
Method Details
-
includeResolver
-
setIncludeResolver
-
efunRegistry
-
setWorldProjection
Selects the native world projection that owns mudlib containment state.Hosted instances set this during boot before loading world objects. Compiler-only runtimes retain an isolated native world by default.
-
worldProjection
Returns the native world projection currently used for LPC containment operations. -
newPreprocessor
-
setParserOptions
Selects the parser profile used for runtime-loaded mudlib source. -
parserOptions
Returns the parser profile used for runtime-loaded mudlib source. -
registerEfun
-
setObjectFactory
-
setObjectLoader
-
setMudlibTextReader
-
setMudlibJsonReader
-
setMudlibJsonArrayReader
Sets the host callback used for bounded, structural reads of mudlib JSON arrays.- Parameters:
mudlibJsonArrayReader- host reader, ornullto restore the unavailable reader
-
setMudlibPathLister
Sets the host callback used by file-listing efuns to enumerate mudlib-rooted paths. -
setMudlibTextAppender
-
setMudlibTextRemover
-
setMudlibTextCopier
-
setMudlibTextRenamer
-
setMudlibDirectoryCreator
-
setMudlibDirectoryRemover
-
setPlayerTransferHandler
-
setLPCObjectStateSaver
-
setLPCObjectStateRestorer
-
setTimedRuntimeErrorHandler
public void setTimedRuntimeErrorHandler(RuntimeContext.TimedRuntimeErrorHandler timedRuntimeErrorHandler) -
setObjectDestructionRequestedHandler
-
registerInMemoryObjectSource
Registers source text for an in-memory LPC object that may later serve as a global helper.Host APIs such as
LPCRuntime.loadSource(...)can compile an LPC object without writing a corresponding.cfile. Declaration-backed global lookup still needs source text to recover function signatures, so those hosts register the source here under the object's normalized mudlib path. -
setMfunObjectPath
Deprecated.usesetMudlibBoundary(MudlibBoundary)withMudlibBoundary.mudlibGlobalObjectPath()metadata.Sets the mudlib-owned global mfun object path used by older callers. -
setMudlibBoundary
Sets active mudlib boundary metadata for generated-code helpers and compatibility lookup. -
engineFunctionName
-
setScheduler
-
setOutputSink
-
write
Writes text to the current execution recipient, or to the transcript in detached contexts. -
writeToLpcObject
Writes text only to the target object's bound session.Unlike
write(Object), this targeted write deliberately does not fall back to the ambient output transcript when the target is not interactive. If that target is later bound to a Session, JVMud flushes the pending text to the target's own output sink. -
writeToSession
-
writeToPlayer
-
writeToPersona
-
emitPerceivable
-
emitPerceivableExcept
-
emitPerceivableAt
-
outputTranscript
-
clearOutputTranscript
public void clearOutputTranscript() -
resolveEfun
-
resolveEngineEfun
-
invokeEfun
Invokes a mudlib-visible function through the active compatibility boundary.Mfuns normally shadow engine efuns. When the mudlib profile maps a mudlib-visible name to an engine function and the call carries a first-class callable, the mapped engine function is allowed to run before a string-typed mfun wrapper can coerce the callable into display text.
-
registerObject
Binds an engine object to a mudlib object path.An object has one canonical mudlib path for APIs such as
file_name(). Rebinding removes the object's previous canonical path, and replacing an existing path clears the old occupant's reverse lookup. This lets a mudlib-created object serve a requested missing source path without retaining its temporary clone id as the canonical identity. -
getObject
-
loadOrGetObject
-
objectsView
-
objects
-
objectId
-
inheritedPrograms
Returns the LPC program path and transitive inherited program paths for a generated LPC object.JVMud exposes this as the backing data for LPMud
inherit_listcompatibility. Generated bytecode exposes inherited compiler metadata through a synthetic method. The object registry supplies the object's own program path. Host objects and older generated classes that do not expose the method are treated as having no LPC inherits rather than failing runtime execution. -
isDestroyedObject
-
cloneObject
-
users
Returns mudlib-facing interactive personas that are in normal command mode.Login controllers waiting for their own
input_to()callbacks are still bound to the socket for input delivery, but legacyusers()output should not count them as logged-in players. Gameplay objects that are temporarily waiting on another object's input callback, such as a pager command, remain visible. -
isInteractive
Returns true when the supplied LPC object is currently bound to an active JVMud session. -
bindPlayerSession
-
bindSession
-
bindSession
-
rebindSessionLpcObject
-
bindSessionProtocolSink
Installs the host transport sink used for out-of-band messages to an interactive persona. -
setSessionProtocolEnabled
-
isSessionProtocolEnabled
-
sendSessionProtocolMessage
-
unbindSession
-
sessionRecord
-
lpcObjectForSession
-
playerRecordForSession
-
personaRecordForProjection
-
captureSessionInput
Captures the next line of interactive session input for the current output persona.The line is delivered to
methodNameon the current LPC object. Any supplied extra arguments are appended after the typed line, matching legacyinput_to()callback shapes such asinput_to("method", flags, arg1, arg2). -
hasCapturedSessionInput
-
capturedSessionInputNoEcho
-
deliverCapturedSessionInput
-
queryIdle
-
queryIpNumber
-
readMudlibText
-
readMudlibJson
-
readMudlibJsonArray
Reads a bounded slice from a JSON array inside a mudlib-rooted file.- Parameters:
path- mudlib-relative JSON file pathpointer- RFC 6901 JSON Pointer selecting an arrayoffset- zero-based first array entry to returncount- maximum number of entries to return- Returns:
- LPC-compatible array slice, or LPC false when the reader cannot access the file
-
listMudlibPaths
-
appendMudlibText
-
removeMudlibText
-
copyMudlibText
-
renameMudlibText
-
createMudlibDirectory
-
removeMudlibDirectory
-
transferCurrentPlayerToGame
-
dbConnect
Opens a configured JDBC database connection and returns a JVMud database handle. -
dbConnect
-
dbExec
Executes SQL for a JVMud database handle and returns the handle on success. -
dbFetch
Fetches one row from a JVMud database handle's current result cursor. -
dbError
Returns the last JDBC error for a JVMud database handle, or LPC false when clear. -
dbClose
public int dbClose(int handle) Closes a JVMud database handle. -
dbHandles
-
dbEscape
-
saveCurrentLPCObjectState
-
restoreCurrentLPCObjectState
-
touchPersona
-
invokeObject
-
invokeOptionalObject
-
hasObjectMethod
Reports whether a generated LPC object exposes a public method with the requested arity.Runtime callable values use this to decide whether a quoted function reference names a method on its lexical object or should fall through to a global efun alias.
- Parameters:
target- generated LPC object to inspectmethodName- LPC method namearity- number of arguments expected by the caller- Returns:
truewhen the object can receive that method call
-
moveObject
Moves one LPC object and immediately starts the destination interaction scope for a connected command actor.Movement is itself a lifecycle boundary. A room and the nearby objects must observe a connected actor's arrival before that actor can issue another command; deferring their lifecycle methods until the next command can let the actor leave before entrance events and temporary interactions are installed.
-
environment
-
present
-
bindEntityAlias
-
findEntityAlias
-
entityHasAlias
-
enableEntityCommands
-
disableEntityCommands
-
entityCommandsEnabled
-
setEntityTranslucent
-
entityTranslucent
-
firstInventory
-
nextInventory
-
destructObject
-
scheduleDeferredCallback
Schedules a one-shot callback on the current object without replacing other callbacks that happen to target the same method.Method names are not task identities: mudlibs commonly fan out an event by scheduling the same delivery method once per subscriber. Each registration therefore remains independently cancellable and deliverable. The active command actor is also captured per registration so delayed work observes the same actor that initiated it.
-
cancelDeferredCallback
Cancels the earliest pending callback for the named method on the current object. -
scheduleRecurringTick
public void scheduleRecurringTick(int enabled, int intervalSeconds) -
currentObject
-
previousObject
-
currentCommandActor
-
currentCommandVerb
-
configureCommandAliases
Installs host-level command aliases used before LPC action lookup.Compatibility mudlibs may configure a command-modification hook with mappings such as
([ "n": "north" ]). JVMud keeps that compatibility at the runtime command boundary: the first word is rewritten before registeredadd_actionverbs are selected, andquery_verb()sees the expanded verb. -
notifyCommandFailure
Records the command failure text to display when no command action accepts the line.Legacy mudlibs use
notify_fail()inside an action that returns false. JVMud stores the latest message for the active dispatch and writes it only after all candidate actions have declined the command. -
pushCurrentObject
-
popCurrentObject
public void popCurrentObject() -
withCurrentObject
-
runWithCurrentObject
-
withCommandActor
-
rememberActionMethod
-
registerVerb
-
registerVerb
Registers a pending LPC command action for the active command actor.Agent-owned actions may be declared while an LPC object is initializing, before any command is being dispatched. In that persistent case, the action is bound to the current LPC object itself so it remains available after initialization. Scoped interaction registrations, such as location-specific
init()actions, still require the command actor supplied by the refresh pass. -
clearCommandActions
-
removeCommandActions
Removes command actions owned by a handler from one actor's current command table.This backs compatibility
remove_action()calls used by temporary selectors and conversations. The mudlib names the actor whose command table should be edited; JVMud uses the current LPC object as the owning action handler. -
clearPendingActionMethods
public void clearPendingActionMethods() -
withScopedCommandRegistration
-
dispatchCommand
-
setLight
public int setLight(int delta)
-
setMudlibBoundary(MudlibBoundary)withMudlibBoundary.mudlibGlobalObjectPath()metadata.