Paradigm | multi-paradigm: object-oriented, functional, procedural, prototype-based |
---|---|
Designed by | Lars Pensjö |
Developer | Lars Pensjö, Jörn Rennecke, Felix Croes, Tim Hollebeek, Lars Düning and others |
Typing discipline | Weak static, strong dynamic |
Website | lpmuds |
Major implementations | |
LPMud | |
Dialects | |
Amylaar, MudOS, FluffOS, LDMud, DGD, SWLPC | |
Influenced by | |
C, C++, Lisp, Perl | |
Influenced | |
Pike |
LPC (short for Lars Pensjö C) is an object-oriented programming language derived from C and developed originally by Lars Pensjö to facilitate MUD building on LPMuds. Though designed for game development, its flexibility has led to it being used for a variety of purposes, and to its evolution into the language Pike.
LPC syntax places it in the family of C-like languages, with C and C++ its strongest influences.
Almost everything in LPC is an object. However, LPC does not precisely use the concept of a class (MudOS has something called a class, but it is really a struct). Instead, LPC objects are blueprint objects and clones of blueprint objects, in a prototype-based programming model. One can treat a blueprint object much as a class in other object-oriented languages.
Each object has variables (attributes) and functions (methods). The variables store the object's state; the functions are executable routines that can be called in the object. An object is uniquely defined by the name of the file in which it comes from, plus, if a clone, a numeric identifier. In a typical implementation, a clone of the file /lib/weapon.c
which is the third clone created in the current run session will be /lib/weapon#3
. The blueprint object corresponding to /lib/weapon.c
is simply /lib/weapon
. In a MUD game, common objects include rooms, weapons, armor, and non-player character (NPCs). Most mudlibs define inheritable objects for such common things. In the LPMud 2.4.5 mudlib, for example, the parent object for all rooms is /lib/room
.