Enhancement - Hooks

- Added Lua copyright notice to the version command.
- Added Lua copyright details to API.cpp, which is the only file that
  interacts with Lua.
- Added hook-type detection.
- Added a hook-type calling mechanism in Hooks.
- Implemented the post-start and pre-exit event triggers.
- Context::initialize now calls Hooks::initialize, which in turn calls
  API::initialize.  We have liftoff!
This commit is contained in:
Paul Beckingham 2010-01-17 14:20:29 -05:00
parent c66d6b0500
commit 57e94585e8
5 changed files with 141 additions and 6 deletions

View file

@ -23,6 +23,28 @@
// 02110-1301
// USA
//
// -------------
//
// Copyright © 19942008 Lua.org, PUC-Rio.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
////////////////////////////////////////////////////////////////////////////////
#include "API.h"
@ -389,7 +411,7 @@ void API::initialize ()
{
// Initialize Lua.
L = lua_open ();
luaL_openlibs (L);
luaL_openlibs (L); // TODO Error handling
// Register all the API functions in Lua global space.
lua_pushcfunction (L, api_task_version); lua_setglobal (L, "task_version");