#include "DeerCore/Scripting/Helpers.h" #include "angelscript.h" namespace Deer { namespace Scripting { const char* getAngelScriptReturnCodeString(int code) { switch (code) { case asSUCCESS: return "SUCCESS (The operation was successful)"; case asERROR: return "ERROR (A generic error occurred)"; case asCONTEXT_ACTIVE: return "CONTEXT_ACTIVE (A context was active during an invalid operation)"; case asCONTEXT_NOT_FINISHED: return "CONTEXT_NOT_FINISHED (Context has not finished execution)"; case asCONTEXT_NOT_PREPARED: return "CONTEXT_NOT_PREPARED (Context is not prepared)"; case asINVALID_ARG: return "INVALID_ARG (An invalid argument was provided)"; case asNO_FUNCTION: return "NO_FUNCTION (Function not found)"; case asNOT_SUPPORTED: return "NOT_SUPPORTED (Feature not supported by build configuration)"; case asINVALID_NAME: return "INVALID_NAME (Name is not allowed or invalid)"; case asNAME_TAKEN: return "NAME_TAKEN (Name is already taken by another entity)"; case asINVALID_DECLARATION: return "INVALID_DECLARATION (The declaration is invalid)"; case asINVALID_OBJECT: return "INVALID_OBJECT (Invalid object handle or object type)"; case asINVALID_TYPE: return "INVALID_TYPE (Invalid type provided)"; case asALREADY_REGISTERED: return "ALREADY_REGISTERED (Item is already registered)"; case asMULTIPLE_FUNCTIONS: return "MULTIPLE_FUNCTIONS (More than one matching function found)"; case asNO_MODULE: return "NO_MODULE (Module was not found)"; case asNO_GLOBAL_VAR: return "NO_GLOBAL_VAR (Global variable was not found)"; case asINVALID_CONFIGURATION: return "INVALID_CONFIGURATION (Invalid configuration, likely during registration)"; case asINVALID_INTERFACE: return "INVALID_INTERFACE (Invalid interface registration)"; case asCANT_BIND_ALL_FUNCTIONS: return "CANT_BIND_ALL_FUNCTIONS (Couldn't bind all functions for a virtual interface)"; case asLOWER_ARRAY_DIMENSION_NOT_REGISTERED: return "LOWER_ARRAY_DIMENSION_NOT_REGISTERED (Lower dimension type for array not registered)"; default: return "Unknown AngelScript error code"; } } bool ImplementsInterface(asITypeInfo* type, asITypeInfo* iface) { for (uint32_t i = 0; i < type->GetInterfaceCount(); i++) { if (type->GetInterface(i) == iface) return true; } return false; } } // namespace Scripting } // namespace Deer