Skip to Content

panorama.object

Lua wrapper around a JavaScript value from Panorama.


Wraps a JavaScript value from Panorama.

OperationResult
obj.key, obj[k]Converted property value. Numeric and boolean keys are converted to text; other key types read nil. JavaScript arrays are zero-based.
obj(...)Calls the JavaScript function and converts the result. Exceptions print in the console and return nil (nil, err for a function panorama.loadstring returned). Calling a non-function returns nil.
#objString length, or the length property when it is a positive number; otherwise 0.
tostring(obj)panorama.object<typeof>, for example panorama.object<function>; panorama.object<invalid> when the value can no longer be read, panorama.object<empty> for an empty wrapper.

A function read from an object retains that object as JavaScript this. Call it with obj.f(a), not obj:f(a), which supplies an unwanted first argument.

JavaScript-to-Lua conversion:

JavaScriptLua
null, undefinednil
boolean, number, stringCorresponding Lua value
Other valuespanorama.object

Lua-to-JavaScript argument conversion:

LuaJavaScript
nilnull
boolean, number, stringCorresponding JavaScript value
panorama.objectWrapped value
Non-empty table with exactly the keys 1..nArray
Other tableObject; string, number and boolean keys are supported

Tables may nest up to 64 levels. Functions, userdata other than panorama.object, cdata, unsupported keys, cycles and deeper nesting raise panorama.object: unsupported argument.

Property assignment is unsupported and raises. Equality compares wrapper handles, not JavaScript values. Objects from old panels become stale after a map change or HUD reload; reads and calls then return nil. Fetch them again.