[Turn off line numbering]
1: arg name, @args;
2: var tmp, kid;
3:
4: (> .perms(sender()) <);
5: (> $sys.touch() <);
6: if (!tostr(name).valid_ident())
7: throw(~invident, name + " is not a valid ident.");
8: (> add_var(name) <);
9: if ('core in .flags())
10: $changelog.log("ADD-VAR: " + this() + "," + name + " by " + sender());
11:
12: // The following code is a kludge as we can't send a default value
13: // to the primitive.
14: if (args) {
15: tmp = tosym("__set_" + tostr(name) + "_" + time());
16: catch any {
17: add_method([tostr(name) + " = " + toliteral(args[1]) + ";"], tmp);
18: .(tmp)();
19: if (args.length() > 1 && args[2] == 'inherit) {
20: for kid in (.descendants())
21: kid.(tmp)();
22: }
23: del_method(tmp);
24: } with {
25: del_method(tmp);
26: rethrow(error());
27: }
28: }
["// Created as a part of ColdCore, see: @help Credit"]