Next: , Previous: , Up: Top   [Contents][Index]


3 Interpreter context

In Lua, after loading the cnrun module with require("cnrun"), the first step is to get an interpreter context. It is an opaque light user data object, which you should pass as the first argument to all subsequent calls to CNrun functions.

You can create and keep multiple models in a context, modify and advance them independently.

The function to create a CNrun context is get_context():

Function: get_context ()

Create a CNrun interpreter context, in which all subsequent operations will be performed.

On success, returns the newly created context object C as the second argument.

Function: drop_context (C)

Drop the interpreter context C, previously obtained with get_context().

In the following sections, context is passed as the first (or only) argument to all functions. It is denoted as C and not described each time.