std-mum
Standard Input/Output Plugin for MuMu/Lava
#License: MIT OR Apache-2.0](LICENSE)
Overview
mumu-std* provides classic and stream-oriented input/output functions for the MuMu/Lava scripting language.
\nIt delivers essential tools like printing, logging, blocking input, and interactive input streams-all as a plugin loaded at runtime.
- Minimal, portable, and follows the Lava plugin architecture.
- Makes I/O explicit and modular not built-in magic.
Features
std:put(value)\t- Print without newline (print)std:log(value)- Print with newline (println_)std:input(prompt)- Prompt the user and read a line (blocking)std:input_iter()- Stream user input lines as an InkIterator (for use in pipelines or functional flows)
Installation
1. Build and Install
Clone and build this crate as you would any MuMu/Lava plugin:
This copies libmumustd.so to /usr/local/lib/.
2. Enable in Lava/MuMu
In your Lava script or REPL, load the plugin:
load_library("std")
Usage Examples
Basic Printing and Input
`lava extend("std")
std:put("Hello, ") std:log("world!") # Outputs: Hello, world!\n
name = std:input("Enter your name: ") std:log("Welcome, " + name)
----
### Stream (Iterator) Input Example
Use `std:input_iter()` to create an iterator over lines from the user (or from piped input):
`lava
extend("std")
inp = std:input_iter()
std:log("Type lines (Ctrl-D to end):")
while (line = inp()) != "_END_"
\t std:log("> " + line)
[Note: The iterator yields one line per call, as a string. Returns "END" (or errors) when no more data. ]
API
std:put(value)
- Prints
valueto stdout without a newline. - Returns the value.
- Example:
std:put("Count: ")
std:log(value)
- Prints
valueto stdout with a newline. - Returns the value.
- Example:
std:log("Done!")
std:input(prompt)
- Prints an optional
promptstring, waits for a line of user input, and returns it as a string. - Blocks until the user enters a line.
- Example:
line = std:input("Next command> ")
std:input_iter()
- Returns an InkIterator that yields each line of user input as a string.
- Non-blocking per call (but blocks when waiting for new input).
- Suitable for functional pipelines,
whileloops, and partial application.
Philosophy
- No I/O is magic. All input/output functions are plugins, not core language.
- Both blocking and stream styles supported.
- Naming:
std:put/std:log` follow Rust/Python/JS idioms.std:input_itermatches Lava's stream/InkIterator conventions.
License
Dual-licensed under MIT and Apache-2.0 (your choice).
See LICENSE for full details.
Support & Contributions
- GitLab project
- PRs and issues welcome!
- Maintained by Tom Fotheringham and contributors.
Version Compatibility
- Works with MuMu/Lava
>= 0.11.0 - Rust edition: 2021
Changelog
- 0.1.0: Initial release –
put,log,input,input_iterimplemented.
Acknowledgments
This project is part of the Lava ecosystem. Big thanks to everyone in the open source and MuMu/Lava community.