Engine functions

Efuns

Efuns are the LPC-facing functions that compiled mudlib objects use to ask JVMud's runtime to do engine work: output, command dispatch, object loading, world containment, scheduling, persistence, and compatibility-oriented data handling.

Boundary Role

JVMud's core efuns use JVMud-native names. Legacy driver names belong in mudlib compatibility profiles through engine function aliases such as engine_function.jvmud_size = sizeof. That keeps familiar LPC source usable without making old driver vocabulary the engine model.

Mudlib code can also qualify calls. efun::name(...) bypasses mudlib shim methods while still honoring configured engine-function aliases. jvmud::name(...) resolves only JVMud-native efuns, such as jvmud::jvmud_size(...); it does not invent a jvmud_ prefix for bad calls.

Current Core Efuns

This page mirrors the built-in catalog registered by CoreEfuns. Overloaded families are shown with arity ranges when each overload has the same behavior.

Output And Perception

SignatureCurrent behavior
voidjvmud_write(mixed message)Writes text to the active output sink.
voidjvmud_write_to_lpc_object(object target, mixed message)Writes text to a target object's bound session, when it has one.
statusjvmud_rebind_session_lpc_object(object newObject, object oldObject)Moves an interactive session binding from one LPC object to another.
voidjvmud_emit_perceivable(mixed emitter, mixed message)Emits a perceivable message from an entity or path-resolved object.
voidjvmud_emit_perceivable_except(mixed emitter, mixed message, mixed excluded)Emits near an entity while suppressing one explicit recipient.
voidjvmud_emit_perceivable_at(mixed location, mixed message)Emits a perceivable message at an explicit location or path-resolved object.

Current Context

SignatureCurrent behavior
objectjvmud_current_lpc_object()Returns the currently executing LPC object.
objectjvmud_previous_lpc_object()Returns the previous LPC object in the active call chain, when available.
objectjvmud_current_actor()Returns the active command actor, falling back to the current object.
objectjvmud_current_agent()Returns the active world-present Agent for the action scope, or LPC false when none is active.
stringjvmud_current_verb()Returns the verb being dispatched for the current command.
objectjvmud_previous_object()Compatibility spelling for the previous LPC object on the runtime call stack.

Command Dispatch

SignatureCurrent behavior
mixedjvmud_dispatch_entity_command(mixed actor, string commandLine)Dispatches a text command as an entity or path-resolved object.
voidjvmud_enable_commands()Marks the current object as command-capable.
voidjvmud_add_action(string methodName)Remembers a method as a command action without registering a verb yet.
voidjvmud_add_action(string methodName, string verb)Remembers an action method and registers a verb for it.
voidjvmud_add_action(string methodName, string verb, status prefix)Registers a verb for an action method, optionally as a prefix verb.
voidjvmud_add_verb(string verb)Registers a verb for the most recently remembered action method in the current interaction scope.

Time And Scheduling

SignatureCurrent behavior
intjvmud_time()Returns Unix epoch seconds from the host clock.
stringjvmud_format_time(int epochSeconds)Formats epoch seconds using the host default time zone.
intjvmud_random(int max)Returns a value in [0, max), or 0 when max <= 0.
voidjvmud_schedule_recurring_tick(int enabled, int intervalSeconds)Schedules or disables recurring temporal ticks for the current object.
voidjvmud_schedule_deferred_callback(string methodName, int delaySeconds)Schedules a one-shot callback on the current object.
voidjvmud_schedule_deferred_callback(string methodName, int delaySeconds, mixed arg...)Schedules a one-shot callback with one to four mudlib-supplied arguments.
intjvmud_cancel_deferred_callback(string methodName)Cancels matching deferred callbacks and returns the runtime cancellation result.

Objects, Entities, And Containment

SignatureCurrent behavior
stringjvmud_lpc_object_id(mixed object)Returns the registered runtime object id for a loaded LPC object.
statusjvmud_method_exists(string name)Reports whether the current object exposes a public mudlib method.
statusjvmud_method_exists(string name, mixed object)Reports whether another loaded object exposes a public mudlib method.
arrayjvmud_inherited_programs(mixed object)Returns the transitive LPC program paths inherited by a generated object.
mixedjvmud_find_lpc_object(string path)Returns an already loaded LPC object, or LPC false when it is not loaded.
mixedjvmud_find_object(string path)Returns an already loaded shared object, or LPC false when it is not loaded.
objectjvmud_load_lpc_object(string path)Loads or returns the shared LPC runtime object for a mudlib path.
objectjvmud_clone_lpc_object(string path)Clones an LPC object and returns the new runtime instance.
mixedjvmud_invoke_lpc_object(mixed target, string methodName, mixed arg...)Invokes an optional method on an object or path-resolved shared object; registered for arities 2 through 6.
voidjvmud_destroy_lpc_object(object object)Destroys an LPC object and removes it from runtime indexes.
voidjvmud_set_entity_location(mixed entity, mixed location)Sets an entity's location or containment directly.
voidjvmud_move_entity(mixed entity, mixed destination)Moves an entity or path-resolved object through runtime containment.
objectjvmud_find_entity(string id)Finds an entity by id in the default scope.
objectjvmud_find_entity(mixed id, mixed location)Finds an entity by id inside a supplied location or container.
objectjvmud_entity_location()Returns the current object's immediate location.
objectjvmud_entity_location(mixed entity)Returns another entity's immediate location.
objectjvmud_first_entity_at(mixed location)Starts traversal of entities in a location or container.
objectjvmud_next_entity_at(mixed entity)Continues traversal from a previous entity in the same inventory walk.

Aliases, Capabilities, And Light

SignatureCurrent behavior
voidjvmud_bind_entity_alias(object entity, string alias, mixed location)Binds a lookup alias for an entity in a location scope.
objectjvmud_find_entity_alias(string alias, mixed location)Resolves an alias in a location scope.
statusjvmud_entity_has_alias(mixed entity, string alias)Reports whether an entity has a registered alias.
statusjvmud_entity_commands_enabled(mixed entity)Reports whether command handling is enabled for an entity.
voidjvmud_set_entity_translucent(mixed entity, status translucent)Controls whether ambient perception such as light passes through an entity container.
statusjvmud_entity_translucent(mixed entity)Reports whether an entity is currently translucent.
intjvmud_set_light(int delta)Adjusts current runtime light and returns the resulting light value.

Sessions, Users, And Host Requests

SignatureCurrent behavior
arrayjvmud_users()Returns the active user/player objects known to the runtime.
statusjvmud_interactive(mixed user)Reports whether an object is bound to an active session.
mixedjvmud_interactive_info(mixed user, int key)Returns LPC false for driver-specific interactive metadata JVMud does not expose.
mixedjvmud_lpc_object_info(mixed object, int key)Returns LPC false for driver-specific LPC object metadata JVMud does not expose.
mixedjvmud_object_info(mixed object, int key)Returns LPC false for driver-specific object metadata JVMud does not expose.
statusjvmud_configure_lpc_object(mixed object, int key, mixed value)Accepts driver-specific LPC object configuration requests conservatively.
statusjvmud_configure_object(mixed object, int key, mixed value)Accepts driver-specific object configuration requests conservatively.
voidjvmud_shutdown()Accepts legacy shutdown requests without exposing driver control to mudlib code.
voidjvmud_set_this_player(mixed player)Accepts legacy current-player mutation requests while JVMud keeps session ownership engine-side.
voidjvmud_raise_error(mixed message)Raises a runtime exception with the supplied LPC message.
intjvmud_query_idle(mixed user)Returns idle time for a runtime session/user target.
mixedjvmud_query_ip_number(mixed user)Returns the user's remote address, or LPC false when unavailable.
mixedjvmud_driver_info(int key)Returns LPC false for unsupported driver-info metadata queries.
voidjvmud_capture_session_input(string methodName, int noEcho, mixed arg...)Routes the next session input line to a method on the current object; registered for arities 2 through 8.
statusjvmud_transfer_player_to_game(string gameId)Asks the host to transfer the current player to another registered game.

Files, Persistence, And Databases

SignatureCurrent behavior
mixedjvmud_read_mudlib_text(string path)Reads a mudlib-relative text file, returning LPC false when unavailable.
mixedjvmud_read_mudlib_text(string path, int startLine, int lineCount)Reads a line slice from a mudlib-relative text file for legacy file helpers.
arrayjvmud_list_mudlib_paths(string path)Lists mudlib-relative paths with default listing flags.
arrayjvmud_list_mudlib_paths(string path, int flags)Lists mudlib-relative paths, including simple glob support for compatibility discovery.
statusjvmud_append_mudlib_text(string path, mixed text)Appends text to a mudlib-relative file.
statusjvmud_remove_mudlib_text(string path)Removes a mudlib-relative file.
intjvmud_copy_mudlib_text(string source, string destination)Copies a mudlib-relative file, returning LDMud-style zero for success.
intjvmud_rename_mudlib_text(string source, string destination)Renames a mudlib-relative path, returning LDMud-style zero for success.
statusjvmud_create_mudlib_directory(string path)Creates a mudlib-relative directory.
statusjvmud_remove_mudlib_directory(string path)Removes an empty mudlib-relative directory.
statusjvmud_save_lpc_object_state(string path)Persists the current object's LPC fields.
statusjvmud_restore_lpc_object_state(string path)Restores the current object's LPC fields.
intjvmud_db_connect(string database)Opens a configured JDBC database handle.
intjvmud_db_connect(string database, string user, string password)Opens a JDBC database handle with mudlib-supplied credentials.
intjvmud_db_exec(int handle, string sql)Executes SQL and retains any result cursor for later fetches.
mixedjvmud_db_fetch(int handle)Returns the next result row as an LPC array, or LPC false when no row remains.
mixedjvmud_db_error(int handle)Returns the last SQL error for a handle.
statusjvmud_db_close(int handle)Closes a database handle.
arrayjvmud_db_handles()Returns currently open database handles.
stringjvmud_db_escape(mixed value)Escapes text for mudlib-generated SQL.

Security Helpers

SignatureCurrent behavior
stringjvmud_hash_password(string password)Returns a PBKDF2-SHA256 password hash string.
statusjvmud_verify_password(string password, string encodedHash)Verifies a password against a hash created by jvmud_hash_password.

Text And Regex

SignatureCurrent behavior
stringjvmud_lowercase_text(mixed value)Converts text to lowercase.
stringjvmud_uppercase_text(mixed value)Converts text to uppercase.
arrayjvmud_split_text(string text, string delimiter)Splits text on a literal delimiter while preserving empty trailing fields.
mixedjvmud_regex_match(array values, string pattern)Returns values whose string forms match a compatibility regular expression, or LPC false when none match.
mixedjvmud_regex_match(array values, string pattern, int flags)Compatibility regex match with flags.
stringjvmud_regex_replace(string input, string pattern, mixed replacement, int flags)Performs compatibility regex replacement for legacy mudlib text helpers, including function callbacks that receive each matched string.
arrayjvmud_regex_explode(string input, string pattern)Splits text around regular-expression matches while preserving matched delimiters.
intjvmud_to_int(mixed value)Converts numeric values and base-10 text to an integer, returning false-style zero for non-numeric input.
stringjvmud_to_string(mixed value)Converts a mixed LPC value to JVMud text form.
stringjvmud_capitalize_text(mixed value)Capitalizes the first character of text.
stringjvmud_wrap_text(mixed text)Wraps description text at the default 78-column width.
stringjvmud_wrap_text(mixed text, int width)Wraps description text at a requested line width.
stringjvmud_format_text(string format, mixed arg...)Formats text using the host formatter; registered for arities 1 through 24.
stringjvmud_extract_text(mixed value, int from)Extracts text from an inclusive start index through the end.
stringjvmud_extract_text(mixed value, int from, int to)Extracts text using inclusive start and end indexes.

Collections, Types, And Values

SignatureCurrent behavior
intjvmud_size(mixed value)Returns the size of a string, collection, mapping, or array.
intjvmud_member(mixed value, mixed needle)Checks mapping key membership or returns the index of a value in an array or string.
arrayjvmud_mapping_keys(mapping value)Returns a mapping's keys in runtime iteration order.
arrayjvmud_mapping_values(mapping value)Returns a mapping's values in runtime iteration order.
mappingjvmud_mapping_from_keys(array keys)Builds a mapping whose keys come from an array and whose values are LPC true.
mappingjvmud_mapping_delete(mapping value, mixed key)Removes a key from a mutable mapping and returns the same mapping.
stringjvmud_serialize_lpc_value(mixed value)Serializes LPC data values to JVMud's tagged JSON payload.
mixedjvmud_deserialize_lpc_value(string data)Restores LPC data values produced by jvmud_serialize_lpc_value.
statusjvmud_is_string(mixed value)Reports whether the value is Java-backed LPC string data.
statusjvmud_is_int(mixed value)Reports whether the value is Java-backed LPC integer data.
statusjvmud_is_object(mixed value)Reports whether the value is a live runtime object.
statusjvmud_is_array(mixed value)Reports whether the value is Java-backed LPC array data.
statusjvmud_is_mapping(mixed value)Reports whether the value is Java-backed LPC mapping data.
mappingjvmud_filter_indices(mapping values, function callback, mixed arg...)Returns entries whose keys satisfy a callable predicate; registered for arities 2 through 8.
arrayjvmud_allocate(int size)Returns a zero-filled LPC array of non-negative size.
intjvmud_sscanf(mixed input, mixed format, mixed capture...)Scans text into supplied capture targets; registered for arities 3 through 8.