Additions to Standard Lua
We have added a lot of useful classes to the stock Lua interpreter. The following is just a summary - the actual documentation for these functions, classes, and methods can be found in the API reference, which can be found inside the development environment.
Improvements to Math, String, and Table libraries
Standard lua includes built-in functions in the math, string, and table namespaces. We have substantially extended these function catalogs. For example, the math library includes new trigonometric functions that accept degrees instead of radians. The string library includes a large number of new functions, mostly inspired by php and python. The table library includes new functions such as array concatenation, key sorting, deep printing, and so forth. These additions are straightforward, but useful.
3D Math
We have added classes designed to help record positional and rotational data. These include:
- Vector is used for representing both Cartesian coordinates and directional vectors. It consists of three numbers usually called (X,Y,Z). It is also sometimes used to represent scaling factors.
- Rotation is used to record orientations and rotations. Since there are so many different ways to express the idea of rotation, there are a large number of different constructors for class Rotation.
- Transform is a small class with room to store one position-vector, one rotation, and one scale-vector. Together, these three things completely describe the location of an object.
Finally, there is a class Matrix which we ask that you not use - basically, we feel that if you need to use math which is that complex, then we're doing something wrong. However, we've included it just in case somebody needs it for something we didn't expect.
Coroutine Handling
Lua has a built-in class coroutine which does not include any sort of scheduling support. We have replaced this class with our own version, Coroutines, which is integrated with the system timer module.
The Module System
We have added a module system that allows you to load script files from the Wild Pockets file server. This is described in a previous chapter.
Class Definitions
We have added a module system that allows you to define your own classes. If you wish, you can still use Lua metamethods to create your own class system.
Abstract Data Types
Most modern programming languages provide a full library of abstract data types like hash tables, binary trees, stacks, queues, priority queues, and the like. Lua is one of the few languages in which the library is missing these fundamental structures (only hash tables and stacks are provided). This is one of the larger flaws in Lua.
We plan to remedy this by supplementing Lua with these core types. Currently, we have only implemented one: the double-ended queue (Deque). This can efficiently mimic a stack or a queue as well.
Things we Removed
We have removed a few things from the Lua interpreter, mostly for safety. These include:
- The io module is gone. A web-game shouldn't be able to delete your files.
- The lua module system is gone, replaced with one that downloads modules from the Wild Pockets file server.
- Printer-friendly version
- Login or register to post comments
-
