Skip to content

bLuaValue

A bLuaValue (also referred to as "value") is an object representing some value in Lua. It can be many types, some of which aren't directly translated into C# such as threads and tables, and can also be a reference ID pointing to a C# object. Values exist within a specific bLuaInstance, and wont work if used on other instances.


Properties

luaType

Returns the LuaType of this value.


Methods

IsNil

Returns true if this value is nil.

To(Bool/Number/Int/Float/String/List/Dictionary)

Attempts to convert the value to a C# type based on the specific function called (ToBool, ToNumber, etc). If the conversion can't be done, the default value of that type will be returned. You can check the LuaType of this value before calling this function by checking the luaType property first.

ToPointer

Attempts to convert the value to an IntPtr "pointer". If the conversion can't be done, the default value of IntPtr will be returned. This function is typically used for Lua types that don't have a C# representation, such as threads and tables, in which case the "pointer" points to the object in Lua.

ToObject

Attempts to convert the value to an object. If the conversion can't be done, null will be returned. This function is typically used for C# types that don't have a Lua representation, such as userdata.

ToUserData

Attempts to convert the value to the given type <T>. If the conversion can't be done, null will be returned. This function is typically used for C# types that don't have a Lua representation.

IsUserDataType

Returns true if this value represents userdata with the given type <T>.


Static Methods

CreateNil

Returns a value that represents nil.

Create(Bool/Number/String)

Returns a new value that represents the given value based on the specific function called (CreateBool, CreateNumber, etc).

CreateUserData

Returns a new value that represents the given [userdata supported] C# object.