(svn r10613) [NoAI] -Add r10612: give release-hook for return values of classes for which SQ creates a temporary holder so they are free'd when SQ does
#include "ai_list.hpp"
namespace SQConvert {
/* Allow AIList to be used as Squirrel parameter */
template <> AIList *GetParam(ForceType<AIList *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIList *)instance; }
template <> AIList &GetParam(ForceType<AIList &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIList *)instance; }
template <> const AIList *GetParam(ForceType<const AIList *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIList *)instance; }
template <> const AIList &GetParam(ForceType<const AIList &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIList *)instance; }
template <> int Return<AIList *>(HSQUIRRELVM vm, AIList *res) { HSQOBJECT instance; Squirrel::CreateClassInstanceVM(vm, "AIList", res, &instance, DefSQDestructorCallback<AIList>); sq_pushobject(vm, instance); return 1; }
}; // namespace SQConvert
void SQAIListRegister(Squirrel *engine) {
DefSQClass <AIList> SQAIList("AIList");
SQAIList.PreRegister(engine, "AIAbstractList");
SQAIList.AddConstructor<void (AIList::*)(), 1>(engine, "x");
SQAIList.DefSQStaticMethod(engine, &AIList::GetClassName, "GetClassName", 1, "x");
SQAIList.DefSQMethod(engine, &AIList::AddItem, "AddItem", 3, "xii");
SQAIList.DefSQMethod(engine, &AIList::ChangeItem, "ChangeItem", 3, "xii");
SQAIList.DefSQMethod(engine, &AIList::RemoveItem, "RemoveItem", 2, "xi");
SQAIList.PostRegister(engine);
}