Miscellaneous Utilities

Hash Support

void asbind20::ext::register_script_hash(asIScriptEngine *engine, bool generic = has_max_portability())

Register hash support for primitive types.

Assertion Support

void asbind20::ext::register_script_assert(asIScriptEngine *engine, std::function<assert_handler_type> callback, bool set_ex = true, asIStringFactory *str_factory = nullptr)

Register script assertion support.

Parameters:
  • callback – Callback for assertion failure

  • set_ex – Set script exception on assertion failure

  • str_factory – String factory for extracting assertion message

Script Loading and Execution

int asbind20::ext::load_string(asIScriptModule *m, const char *section_name, std::string_view code, int line_offset = 0)

Load a string as script section.

Returns:

int AngelScript error code

int asbind20::ext::load_file(asIScriptModule *m, const std::filesystem::path &filename, std::ios_base::openmode mode = std::ios_base::in)

Load a file as script section.

Returns:

int AngelScript error code

int asbind20::ext::exec(asIScriptEngine *engine, std::string_view code, asIScriptContext *ctx = nullptr)

Execute a piece of AngelScript code.