API Documentation
Static Public Member Functions | List of all members
nkAstraeus::nkScriptsWrap::EnvironmentWrapper Class Referencefinal

Wraps a nkScripts::Environment and offer functions for use in scripting. More...

Static Public Member Functions

static void updateEnvironment (nkScripts::Environment *env)
 

Detailed Description

Wraps a nkScripts::Environment and offer functions for use in scripting.

The environment is particular as its offers static functions not exposed in the wrapper :

-> Wrapper for nkScripts::Environmnent::serialize().

local d = nkScripts.serialize(t) ;

-> Wrapper for nkScripts::Environment::serialize(), with a forward in the ownership of any C++ defined user data.

local d = nkScripts.serializeForwardOwnership(t) ;

-> Wrapper for nkScripts::Environment::deserialize().

local t = nkScripts.deserialize(d) ;

Note that ownership of data can be a delicate subject when going from one Environment to another, for instance for threading.

This is why ownership forwarding can be done, as it will prevent garbage collection from happening in the Environment that allocated the user data in the first place. It is important to know when the scripting environment owns the memory allocated. See nkScripts::UserType to have more information on that matter.

Member Function Documentation

◆ updateEnvironment()

static void nkAstraeus::nkScriptsWrap::EnvironmentWrapper::updateEnvironment ( nkScripts::Environment env)
static

Updates a given environment and set it up to use all functions wrapped by this wrapper.

Parameters
envThe environment to set up.

The documentation for this class was generated from the following file: