When writing a Python program the API must be imported by
import harfang as hg before it can be accessed.
Global symbols are defined in the API root object
hg and can be directly accessed from there.
Here is an example on how to create a new object of Vector3 type in Python...
import harfang as hg v = hg.Vector3() # v now holds a Vector3 object
Symbols defined in a class are accessible through the class object itself. Here is an example on how to access the LightModel enumeration in Python...
l = hg.Light() l.SetModel(hg.LightModelSpot) # set the light component model to spot
The API is imported to Lua programs via
hg = require("harfang")
hg = require("harfang") v = hg.Vector3() -- v now holds a Vector3 object
hg = require("harfang") l = hg.Light() l:SetModel(hg.LightModelSpot) -- set the light component model to spot