gameplay3d/GamePlay — pull request #1624 by sgrenier (2014-12-18 04:01:19+00:00)
Title: Scripting support overhaul

This pull includes a number of changes to the script system. Backwards compatibility was maintained where it was possible (and made sense), but there are a few script-related C++ APIs that were changed/removed.

Main changes/features include:
- Support for 'protected' scripts, which are essentially non-global Lua scripts that execute in their own private environment. These scripts are most useful for associating with objects in a game as there can be multiple instances of the same script loaded, each with its own instance data and functions (whose names do not intercept those in other protected scripts). This comes with no performance cost (in fact, a slight increase in performance was measured).
- A change to how script events are registered and fired for classes that wish to expose script events, with some optimizations to eliminate expensive string allocation and lookups at runtime.
- A change to how script events are implemented in Lua. While global Lua scripts and callbacks are still supported (all scripts in gameplay were previously global), protected scripts can be assigned to ScriptTargets (such as Node) and any declared functions that match a valid supported event signature will be automatically called. Essentially, these scripts work similar to overriding methods in an object-oriented class.
- A new "script" property to (optionally) replace the old "scripts" property in game.config. The new property can point to a Lua script that declares zero or more game script events (initialize, update, render, keyEvent, etc).
- A number of other script-related changes.

This pull also includes a change to the LUA bindings generator to simplify enum bindings, effectively speeding them up and removing a large number of binding source files that are no longer needed.