call - syntax: call("progid",[CH],[ROOM],[OBJ],[SELF]
Call is used to execute one Lua mud program from within another. For builders used to the mobprog system, the main difference in this call is that the character, room, object and even the actor (self) can be changed for that call only. In the example below, the test mob running prog test-1 states the room it is in, then calls prog test-2 but with the room variable changed. Prog test-2 outputs some other information then returns to test-1. You can see that the room in test-1 was not affected.
--- prog test-1, running on an owl in room tol-30 --- (On a high branch) say("calling test-2") call ("tol-48",nil,getroom("tol-20")) say("done calling test-2") say("back in test-1 we are in " .. room.name .. "/" .. room.key) --- prog test-2 say("I am " .. self.name .. " you are " .. ch.name .. " we are in " > .. room.name .. "/" .. room.key) Running this prog gives the output: You say 'go' An owl says 'calling test-1' An owl says 'I am an owl you are Lasher we are in A Middle > Branch/tol-20' An owl says 'done calling test-2' An owl says 'back in test-2 we are in On a High Branch/tol-30'
Call is particularly important in replacing former 'mob call mob ...' commands, see the Lua Howto page for more on this