This is an old revision of the document!
Script Environments
With the exception of the shared table all Lua scripts run in the environment they're first called upon and by default have no access to variables or methods in other environments. These environments are the OBJ, CH/MOB, ROOM, AREA spaces, along with a few others. There are several ways to "break out" of an environment and affect external environments.
Simple Interactions
The most common way to manipulate an outside environment is with the Prog Trigger mechanism. Mob Progs, Obj Progs, Room Progs and Area Progs all return a CH object, and some return an OBJ object.
For example, in this simple script, a Mob Prog will return the name of a CH, which is a property of CH.
-- GRALL. Let's say HI! to PCs if ch.ispc then – ispc is also a property of CH say("HI "..ch.name.."!") end
These simple interactions often depend on the method that wants to be called being available to the environment that is calling it. For example, setval is a method of CH, so if a mob wanted to set a PC's setval upon entering a room, it would be quite simple: