MOO-cows Mailing List Archive


Re: File stuff for LPMOO

> Hi, I been looking all throughout the LPMOO archives looking for patches 
> or info on how to make LPMOO do file stuff, ie. saving and retrieving 
> files.  If anyone knows of anything, or can point me in the right 
> direction if I am blind I would be semi-eternally gratefull.

The /lpc/filesys.c example that comes with LPMOO shows how to write an LPC
interface to the filesystem that can be accessed from wizardly MOO programs.

On MirrorMOO, a Filesystem Feature object has been created to provide commands
such as cd, pwd, ls, cat/more, head/tail; you're welcome to examine the code
in the object to see how it uses /lpc/filesys (aka $lpc.filesys). All users
have this feature by default, so you can use it to browse the underlying
filesystem of MirrorMOO.

An editor module has also been written to allow the MOO's internal editor to
edit real files in the underlying filesystem, also through use of the same
/lpc/filesys example. (MCP support also allows you to edit files locally with
an appropriate client.)

This is, of course, only meant to be an example. You can modify the LPC code
on-the-fly to meet your needs. A complete filesystem interface (perhaps along
the lines of FUP) would require more detailed LPC to be written.

MirrorMOO's address is 8889. The Filesystem Feature object
is #250. The file editor module is $file_editor. The /lpc/filesys.c example
file itself comes bundled with LPMOO, under the mudlib directory.

Robert Leslie

Home | Subject Index | Thread Index