MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | CONCEPT |
| 2 | lfuns |
| 3 | |
| 4 | DESCRIPTION |
| 5 | A lfun is a LPC function within an object which is public and can |
| 6 | be called by other objects. In OO terms, lfuns are "methods" |
| 7 | which you can send "messages" to. |
| 8 | |
| 9 | Calling lfuns is done by using the efun call_other(), which |
| 10 | takes as arguments the object in which the lfun is to be called, |
| 11 | the name of the lfun to be called in the object, and additional |
| 12 | and optional arguments. |
| 13 | |
| 14 | An example looks like this: |
| 15 | |
| 16 | call_other(drink, "QueryShort"); |
| 17 | |
| 18 | This call may also be written as |
| 19 | |
| 20 | drink->QueryShort(); |
| 21 | |
| 22 | This means call_other(object, "function", args...) can also be |
| 23 | written as object->function(args...). The second form is |
| 24 | preferred as it is easier to read. |
| 25 | |
| 26 | Some lfuns have a special meaning for the LPC driver, because |
| 27 | they are applied by the interpreter instead from an LPC object. |
| 28 | To distinguish those, they are called ``applied lfuns''. |
| 29 | |
| 30 | SEE ALSO |
| 31 | efuns(LPC), efun(E), applied(A), master(M), call_other(E) |