Lua 関数の IsObjectValid は、指定された引数が有効なオブジェクトかどうかに応じて、ブール値の true または nil を返します。
以下の例では、"Root()"" が有効なオブジェクトかどうかを調べて、その結果を出力しています。
return function()
--Create a variable with the possible object
local myObject = Root()
--Check if it is an object
local myReturn = IsObjectValid(myObject)
--Print the result
if myReturn == nil then
ErrPrintf("It is not a valid object")
else
Printf("It is an object")
end
end