/*****************************************************************************
 * $LastChangedDate: 2011-03-15 14:18:37 -0400 (Tue, 15 Mar 2011) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   Interface of C functions for Lua scripts.
 * @remarks @remarks module.txt documents how to export new C++ classes to Lua.
 *
 * ----------------------------
 * -- THIS IS AUTO-GENERATED --
 * ----------------------------
 *
 *//*
 * LEGAL:   COPYRIGHT (C) 2008 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
 *****************************************************************************/

#include "base/module.hh"
using namespace base;
#include "view/module.hh"
#include "view/observer_current_craft.hh"
using namespace view;
#include "lua_bind/module.hh"
#include "lua_bind/bind.hh"

namespace lua {


namespace bind {

#define BIND_CLASS_NAME      "ObserverCurrentCraft"
#define BIND_METATABLE_NAME  LUABIND_METATABLE_STRING(BIND_CLASS_NAME)

//==============================================================================
// C functions called by Lua that access C++ objects.
//==============================================================================
// Need a function to check typesig because of macro/template limitations.
#if ! DOXYGEN
INTERN void
CheckTypesigObserverCurrentCraft( shptr<ObserverCurrentCraft> obj )
{
    CHECK_TYPESIG(obj,TYPESIG_OBSERVER_CURRENT_CRAFT);
}
#endif // ! DOXYGEN

/*****************************************************************************
 * Lua's garbage collector indirectly invokes this C++ destructor.
 *****************************************************************************/
INTERN int 
ObserverCurrentCraft_Destroy( lua_State* L ) 
{ 
   try { 

        return DESTROY_USERDATA_SHPTR<ObserverCurrentCraft>( L, CheckTypesigObserverCurrentCraft );
    
   } CATCH_LUA_EXCEPTION 
   return 0; 
} 

/*****************************************************************************
 * ObserverCurrentCraft:New()
 *****************************************************************************/
INTERN int 
ObserverCurrentCraft_New( lua_State* L ) 
{ 
   try { 

        shptr<ObserverCurrentCraft> observerCurrentCraft = new ObserverCurrentCraft;
        return NEW_USERDATA_SHPTR<ObserverCurrentCraft>( L, observerCurrentCraft, BIND_METATABLE_NAME );
    
   } CATCH_LUA_EXCEPTION 
   return 0; 
} 

//==============================================================================
// Register binding with Lua. 
//==============================================================================

#if ! DOXYGEN 

INTERN const struct luaL_reg sMethodTable[] =
{
  { "New", ObserverCurrentCraft_New },
  { "__gc", ObserverCurrentCraft_Destroy },
  { NULL, NULL }
};

void
RegisterObserverCurrentCraft( lua_State* L )
{
    REGISTER_BINDING( L,
                      BIND_METATABLE_NAME,
                      BIND_CLASS_NAME,
                      sMethodTable );
}

#endif // ! DOXYGEN 

} // namespace bind 

} // namespace lua 
