Library Access
The library access routines allow you to locate scenery objects via the X-Plane library system. Right now library access is only provided for objects, allowing plugin-drawn objects to be extended using the library system.
XPLMLibraryEnumerator_f
callback
An XPLMLibraryEnumerator_f is a callback you provide that is called once for each library element that is located. The returned paths will be relative to the X-System folder.
function my_LibraryEnumerator_callback(
inFilePath, -- string
inRef -- any Lua var/table
)
-- your code here
end
XPLMLookupObjects
function
This routine looks up a virtual path in the library system and returns all matching elements. You provide a callback - one virtual path may match many objects in the library. XPLMLookupObjects returns the number of objects found.
The latitude and longitude parameters specify the location the object will be used. The library system allows for scenery packages to only provide objects to certain local locations. Only objects that are allowed at the latitude/longitude you provide will be returned.
The enumerator is fully synchronous: it is called once per matching object, and all calls complete before XPLMLookupObjects returns.
-- returns int -> assign to local/var
local my_result = XPLMLookupObjects(
inPath, -- string
inLatitude, -- float
inLongitude, -- float
enumerator, -- see XPLMLibraryEnumerator_f
ref -- any Lua var/table
)
See associated types: