blob: e04e91d96746a6a78db47da50e647d4ea651e6d6 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
2 void flag(string arg)
3
4DESCRIPTION
5 Evaluate an argument given as option '-f' to the driver.
6 If several '-f' options are given, this function will be
7 called sequentially with all given arguments.
8 This function can be used to pass the master commands via
9 arguments to the driver. This is useful when building a new
10 mudlib from scratch. It is called only when the system is
11 started.
12
13EXAMPLE
14 // The code given implements these commands:
15 // '-fcall <ob> <fun> <arg>': call function <fun> in object <ob> with
16 // argument <arg>.
17 // '-fshutdown': shutdown the system immediately.
18 // Thus, starting the driver as
19 // 'parse "-fcall foo bar Yow!" -fshutdown' would
20 // first do foo->bar("Yow!") and then shut down the system.
21
22 {
23 string obj, fun, rest;
24
25 if (arg == "shutdown")
26 {
27 shutdown();
28 return;
29 }
30 if (sscanf(arg, "call %s %s %s", obj, fun, rest) >= 2)
31 {
32 write(obj+"->"+fun+"(\""+rest+"\") = ");
33 write(call_other(obj, fun, rest));
34 write("\n");
35 return;
36 }
37 write("master: Unknown flag "+arg+"\n");
38 }
39
40SEE ALSO
41 master(M)