MoonSharp.Interpreter
Class implementing coroutine Lua functions
Class implementing basic Lua functions (print, type, tostring, etc) as a MoonSharp module.
Class implementing debug Lua functions. Support for the debug module is partial.
Class implementing dynamic expression evaluations at runtime (a MoonSharp addition).
Class implementing error handling Lua functions (pcall and xpcall)
Abstract class implementing a file Lua userdata. Methods are meant to be called by Lua code.
Abstract class implementing a file Lua userdata. Methods are meant to be called by Lua code.
Abstract class implementing an unclosable file Lua userdata. Methods are meant to be called by Lua code.
Abstract class implementing a file Lua userdata. Methods are meant to be called by Lua code.
Namespace containing userdata classes for the 'io' module
Class implementing io Lua functions. Proper support requires a compatible IPlatformAccessor
Class implementing loading Lua functions like 'require', 'load', etc.
Class implementing bit32 Lua functions
Class implementing math Lua functions
Class implementing metatable related Lua functions (xxxmetatable and rawxxx).
Class implementing system related Lua functions from the 'os' module.
Proper support requires a compatible IPlatformAccessor
Class implementing time related Lua functions from the 'os' module.
Class implementing string Lua functions
Class implementing table Lua iterators (pairs, ipairs, next)
Class implementing table Lua functions
Class exposing table.unpack and table.pack in the global namespace (to work around the most common Lua 5.1 compatibility issue).
Namespace containing the implementation of the Lua standard library, as MoonSharp modules.
There's seldom the need to access these classes directly.
A Dictionary where multiple values can be associated to the same key
The key type
The value type
Initializes a new instance of the class.
Initializes a new instance of the class.
The equality comparer to use in the underlying dictionary.
Adds the specified key. Returns true if this is the first value for a given key
The key.
The value.
Finds all the values associated with the specified key.
An empty collection is returned if not found.
The key.
Determines whether this contains the specified key
The key.
Gets the keys.
Clears this instance.
Removes the specified key and all its associated values from the multidictionary
The key.
Removes the value. Returns true if the removed value was the last of a given key
The key.
The value.
Implementation of IEqualityComparer enforcing reference equality
A non preallocated, non_fixed size stack
An index to accelerate operations on a LinkedList using a single key of type
More than one LinkedListIndex can index the same linked list, but every node in the linked list must be indexed by one and only one
LinkedListIndex object.
The type of the key. Must implement Equals and GetHashCode appropriately.
The type of the values contained in the linked list.
Initializes a new instance of the class.
The linked list to be indexed.
Finds the node indexed by the specified key, or null.
The key.
Updates or creates a new node in the linked list, indexed by the specified key.
The key.
The value.
The previous value of the element
Creates a new node in the linked list, indexed by the specified key.
The key.
The value.
Removes the specified key from the index, and the node indexed by the key from the linked list.
The key.
Determines whether the index contains the specified key.
The key.
Clears this instance (removes all elements)
Provides facility to create a "sliced" view over an existing IList
The type of the items contained in the collection
Initializes a new instance of the class.
The list to apply the Slice view on
From which index
The length of the slice
if set to true the view is in reversed order.
Gets or sets the element at the specified index.
The index.
Gets the index from which the slice starts
Gets the number of elements contained in the .
The number of elements contained in the .
Gets a value indicating whether this operates in a reversed direction.
true if this operates in a reversed direction; otherwise, false.
Calculates the real index in the underlying collection
Returns an enumerator that iterates through the collection.
A that can be used to iterate through the collection.
Returns an enumerator that iterates through a collection.
An object that can be used to iterate through the collection.
Converts to an array.
Converts to an list.
Determines the index of a specific item in the .
The object to locate in the .
The index of if found in the list; otherwise, -1.
Inserts an item to the at the specified index.
The zero-based index at which should be inserted.
The object to insert into the .
Slices are readonly
Removes the item at the specified index.
The zero-based index of the item to remove.
Slices are readonly
Adds an item to the .
The object to add to the .
Slices are readonly
Removes all items from the .
Slices are readonly
Determines whether the contains a specific value.
The object to locate in the .
true if is found in the ; otherwise, false.
Copies to.
The array.
Index of the array.
Gets a value indicating whether the is read-only.
true if the is read-only; otherwise, false.
Removes the first occurrence of a specific object from the .
The object to remove from the .
true if was successfully removed from the ; otherwise, false. This method also returns false if is not found in the original .
Slices are readonly
A preallocated, non-resizable, stack
The scope of a closure (container of upvalues)
Gets the symbols.
Marks a property as a configruation property
The metamethod name (like '__div', '__ipairs', etc.)
Initializes a new instance of the class.
Initializes a new instance of the class.
The name for this property
Marks a method as the handler of metamethods of a userdata type
The metamethod name (like '__div', '__ipairs', etc.)
Initializes a new instance of the class.
The metamethod name (like '__div', '__ipairs', etc.)
Lists a userdata member not to be exposed to scripts referencing it by name.
Gets the name of the member to be hidden.
Initializes a new instance of the class.
Name of the member to hide.
Forces a class member visibility to scripts. Can be used to hide public members. Equivalent to MoonSharpVisible(false).
Base interface to describe access to members of a given type.
While it's not infrastructural to implement custom type descriptors, it's needed for
classes extending .
Gets a value indicating whether the described member is static.
Gets the name of the member
Gets the types of access supported by this member
Gets the value of this member as a to be exposed to scripts.
Implementors should raise exceptions if the value cannot be read or if access to an
instance member through a static userdata is attempted.
The script.
The object owning this member, or null if static.
The value of this member as a .
Sets the value of this member from a .
Implementors should raise exceptions if the value cannot be read or if access to an
instance member through a static userdata is attempted.
The script.
The object owning this member, or null if static.
The value to be set.
Extension methods for and .
Determines whether the specified MemberDescriptorAccess has ALL the specified flags.
The access.
The flag.
Determines whether this instance can be read
The descriptor instance.
Determines whether this instance can be written to
The descriptor instance.
Determines whether this instance can be executed (called as a function)
The descriptor instance.
Gets the getter of the member as a DynValue containing a callback
The descriptor instance.
The script.
The object.
Returns the specified descriptor if it supports all the specified access modes, otherwise returns null.
The descriptor instance.
The access mode(s).
Raises an appropriate ScriptRuntimeException if the specified access is not supported.
Checks are made for the MemberDescriptorAccess permissions AND for the access of instance
members through static userdatas.
The desc.
The access.
The object to be checked for access.
Interface for descriptors of any kind which support optimizations of their implementation according to InteropAccessMode
modes. This should seldom - if ever - be implemented in user code.
Called by standard descriptors when background optimization or preoptimization needs to be performed.
Specialized for members supporting overloads resolution.
Invokes the member from script.
Implementors should raise exceptions if the value cannot be executed or if access to an
instance member through a static userdata is attempted.
The script.
The object.
The context.
The arguments.
Gets the type which this extension method extends, null if this is not an extension method.
Gets the type of the arguments of the underlying CLR function
Gets a value indicating the type of the ParamArray parameter of a var-args function. If the function is not var-args,
null is returned.
Gets a value indicating the type of the elements of the ParamArray parameter of a var-args function. If the function is not var-args,
null is returned.
Gets a sort discriminant to give consistent overload resolution matching in case of perfectly equal scores
Interface for descriptors with the capability of being serialized
for later hardwiring.
Prepares the descriptor for hard-wiring.
The descriptor fills the passed table with all the needed data for hardwire generators to generate the appropriate code.
The table to be filled
Permissions for members access
The member can be read from
The member can be written to
The can be invoked
Descriptor of parameters used in implementations.
Gets the name of the parameter
Gets the type of the parameter
Gets a value indicating whether this instance has a default value.
Gets the default value
Gets a value indicating whether this instance is an out parameter
Gets a value indicating whether this instance is a "ref" parameter
Gets a value indicating whether this instance is a variable arguments param
Gets a value indicating whether this instance has been restricted.
Gets the original type of the parameter before any restriction has been applied.
If the type got restricted, the original type before the restriction.
Initializes a new instance of the class.
The name.
The type.
if set to true the parameter has default value.
The default value.
if set to true, is an out param.
if set to true is a ref param.
if set to true is variable arguments param.
Initializes a new instance of the class.
The name.
The type.
if set to true the parameter has default value.
The default value.
if set to true, is an out param.
if set to true is a ref param.
if set to true is variable arguments param.
The type restriction, or nll.
Initializes a new instance of the class.
A ParameterInfo taken from reflection.
Returns a that represents this instance.
A that represents this instance.
Restricts the type of this parameter to a tighter constraint.
Restrictions must be applied before the containing this
parameter is used in any way.
The new type.
Cannot restrict a ref/out or varargs param
or
Specified operation is not a restriction
Prepares the descriptor for hard-wiring.
The descriptor fills the passed table with all the needed data for hardwire generators to generate the appropriate code.
The table to be filled
An abstract user data descriptor which accepts members described by objects and
correctly dispatches to them.
Metamethods are also by default dispatched to operator overloads and other similar methods - see
.
The special name used by CLR for indexer getters
The special name used by CLR for indexer setters
The special name used by CLR for explicit cast conversions
The special name used by CLR for implicit cast conversions
Gets the name of the descriptor (usually, the name of the type described).
Gets the type this descriptor refers to
Gets a human readable friendly name of the descriptor
Initializes a new instance of the class.
The type this descriptor refers to.
A friendly name for the type, or null.
Adds a member to the meta-members list.
The name of the metamethod.
The desc.
Thrown if a name conflict is detected and one of the conflicting members does not support overloads.
Adds a DynValue as a member
The name.
The value.
Adds a property to the member list
The name.
The descriptor.
Thrown if a name conflict is detected and one of the conflicting members does not support overloads.
Gets the member names.
Gets the members.
Finds the member with a given name. If not found, null is returned.
Name of the member.
Removes the member with a given name. In case of overloaded functions, all overloads are removed.
Name of the member.
Gets the meta member names.
Gets the meta members.
Finds the meta member with a given name. If not found, null is returned.
Name of the member.
Removes the meta member with a given name. In case of overloaded functions, all overloads are removed.
Name of the member.
Performs an "index" "get" operation. This tries to resolve minor variations of member names.
The script originating the request
The object (null if a static request is done)
The index.
If set to true, it's indexed with a name, if false it's indexed through brackets.
Tries to perform an indexing operation by checking newly added extension methods for the given indexName.
The script.
The object.
Member name to be indexed.
Determines whether the descriptor contains the specified member (by exact name)
Name of the member.
Determines whether the descriptor contains the specified member in the meta list (by exact name)
Name of the meta-member.
Tries to perform an indexing operation by checking methods and properties for the given indexName
The script.
The object.
Member name to be indexed.
Performs an "index" "set" operation. This tries to resolve minor variations of member names.
The script originating the request
The object (null if a static request is done)
The index.
The value to be set
If set to true, it's indexed with a name, if false it's indexed through brackets.
Tries to perform an indexing "set" operation by checking methods and properties for the given indexName
The script.
The object.
Member name to be indexed.
The value.
Converts the specified name from underscore_case to camelCase.
Just a wrapper over the method with the same name,
The name.
Converts the specified name to one with an uppercase first letter (something to Something).
Just a wrapper over the method with the same name,
The name.
Converts this userdata to string
The object.
Executes the specified indexer method.
The method descriptor
The script.
The object.
The indexer parameter
The dynvalue to set on a setter, or null.
Gets a "meta" operation on this userdata. If a descriptor does not support this functionality,
it should return "null" (not a nil).
See for further details.
If a method exists marked with for the specific
metamethod requested, that method is returned.
If the above fails, the following dispatching occur:
__add, __sub, __mul, __div, __mod and __unm are dispatched to C# operator overloads (if they exist)
__eq is dispatched to System.Object.Equals.
__lt and __le are dispatched IComparable.Compare, if the type implements IComparable or IComparable{object}
__len is dispatched to Length and Count properties, if those exist.
__iterator is handled if the object implements IEnumerable or IEnumerator.
__tonumber is dispatched to implicit or explicit conversion operators to standard numeric types.
__tobool is dispatched to an implicit or explicit conversion operator to bool. If that fails, operator true is used.
The script originating the request
The object (null if a static request is done)
The name of the metamember.
Determines whether the specified object is compatible with the specified type.
Unless a very specific behaviour is needed, the correct implementation is a
simple " return type.IsInstanceOfType(obj); "
The type.
The object.
Tries to convert a CLR object to a MoonSharp value, using "simple" logic.
Does NOT throw on failure.
Tries to convert a CLR object to a MoonSharp value, using more in-depth analysis
Converts an IEnumerable or IEnumerator to a DynValue
The script.
The object.
Static functions to handle conversions of numeric types
HashSet of numeric types
Array of numeric types in order used for some conversions
Converts a double to another type
Converts a type to double
Converts a DynValue to a CLR object [simple conversion]
Converts a DynValue to a CLR object of a specific type
Gets a relative weight of how much the conversion is matching the given types.
Implementation must follow that of DynValueToObjectOfType.. it's not very DRY in that sense.
However here we are in perf-sensitive path.. TODO : double-check the gain and see if a DRY impl is better.
Converts an IList to a Lua table.
Converts an IDictionary to a Lua table.
Determines whether the specified table can be converted to the specified type
The table.
The type.
Converts a table to a CLR object of a given type
Converts a table to a
Converts a table to a T[]
Converts a table to a
Converts a table to a , known in advance
Converts a table to a Dictionary, known in advance
A collection of custom converters between MoonSharp types and CLR types.
If a converter function is not specified or returns null, the standard conversion path applies.
Sets a custom converter from a script data type to a CLR data type. Set null to remove a previous custom converter.
The script data type
The CLR data type.
The converter, or null.
Gets a custom converter from a script data type to a CLR data type, or null
The script data type
The CLR data type.
The converter function, or null if not found
Sets a custom converter from a CLR data type. Set null to remove a previous custom converter.
The CLR data type.
The converter, or null.
Sets a custom converter from a CLR data type. Set null to remove a previous custom converter.
The CLR data type.
The converter, or null.
Gets a custom converter from a CLR data type, or null
Type of the color data.
The converter function, or null if not found
Sets a custom converter from a CLR data type. Set null to remove a previous custom converter.
The CLR data type.
The converter, or null.
Removes all converters.
Helper extension methods used to simplify some parts of userdata descriptor implementations
Determines whether a
or a is changing visibility of a member
to scripts.
The member to check.
true if visibility is forced visible,
false if visibility is forced hidden or the specified MemberInfo is null,
if no attribute was found
If both MoonSharpHiddenAttribute and MoonSharpVisibleAttribute are specified and they convey different messages.
Gets the visibility of the type as a string
Gets a string representing visibility of the given member type
Gets a string representing visibility of the given member type
Gets a string representing visibility of the given member type
Determines whether the specified PropertyInfo is visible publicly (either the getter or the setter is public).
The PropertyInfo.
Gets the list of metamethod names from attributes - in practice the list of metamethods declared through
.
The mi.
Gets the Types implemented in the assembly, catching the ReflectionTypeLoadException just in case..
The assebly
Gets the name of a conversion method to be exposed to Lua scripts
The type.
Gets all implemented types by a given type
The t.
Determines whether the string is a valid simple identifier (starts with letter or underscore
and contains only letters, digits and underscores).
Converts the string to a valid simple identifier (starts with letter or underscore
and contains only letters, digits and underscores).
Converts the specified name from underscore_case to camelCase.
The name.
Converts the specified name to one with an uppercase first letter (something to Something).
The name.
An interface for type descriptors having the ability to generate other descriptors on the fly.
Generates a new descriptor for the specified type.
The purpose is to allow a mechanism by which a type descriptor can replace itself with another
descriptor for a specific type. For example, descriptors can be created on the fly to support
generic types through this mechanism.
The return value should be:
null - if this descriptor is simply skipped for the specified type
this - acts as if the descriptor was a vanilla descriptor
a new descriptor - if a new descriptor should be used in place of this one
It's recommended that instances of descriptors are cached for future references. One possible way,
to do the caching is to have the generator register the descriptor through .
In that case, it should query whether the type is exactly registered, through
NOTE-1 : the search for descriptors does NOT stop with the descriptor returned by this type, but
other descriptors (e.g. for interfaces) might still be added.
NOTE-2 : the descriptor generation mechanism is not triggered on an exact match of types.
NOTE-3 : the method is called in the context of a lock over the descriptors registry so no unpredictable changes to the
registry can come from other threads during the execution of this method. However this method should not take other
locks, to avoid deadlocks.
The type.
Null, this object instance or a new descriptor.
Utility class which may be used to set properties on an object of type T, from values contained in a Lua table.
Properties must be decorated with the .
This is a generic version of .
The type of the object.
Initializes a new instance of the class.
The expected missing properties, that is expected fields in the table with no corresponding property in the object.
Adds an expected missing property, that is an expected field in the table with no corresponding property in the object.
The name.
Assigns properties from tables to an object.
The object.
The table.
Object is null
A field does not correspond to any property and that property is not one of the expected missing ones.
Gets the type-unsafe assigner corresponding to this object.
Sets the subassigner for the given type. Pass null to remove usage of subassigner for the given type.
Type of the property for which the subassigner will be used.
The property assigner.
Sets the subassigner for the given type
Type of the property for which the subassigner will be used.
The property assigner.
Assigns the properties of the specified object without checking the type.
The object.
The data.
Utility class which may be used to set properties on an object from values contained in a Lua table.
Properties must be decorated with the .
See for a generic compile time type-safe version.
Initializes a new instance of the class.
The type of the object.
The expected missing properties, that is expected fields in the table with no corresponding property in the object.
Type cannot be a value type.
Adds an expected missing property, that is an expected field in the table with no corresponding property in the object.
The name.
Assigns properties from tables to an object.
The object.
The table.
Object is null
The object is of an incompatible type.
A field does not correspond to any property and that property is not one of the expected missing ones.
Sets the subassigner for the given type. Pass null to remove usage of subassigner for the given type.
Type of the property for which the subassigner will be used.
The property assigner.
Assigns the properties of the specified object without checking the type.
The object.
The data.
Common interface for property assigners - basically used for sub-assigners
Assigns the properties of the specified object without checking the type.
The object.
The data.
Implementation of IProxyFactory taking two delegates for simple instancing of proxies.
The type of the proxy.
The type of the target.
Initializes a new instance of the class.
The proxy.
The deproxy.
Takes an instance of a target object and returns a proxy object wrapping it
Takes an instance of a target object and returns a proxy object wrapping it
Gets the proxied type
Gets the proxy type
Interface for proxy objects (type unsafe version)
Takes an instance of a target object and returns a proxy object wrapping it
Gets the proxied type
Gets the proxy type
Interface for proxy objects (type safe version)
The type of the proxy.
The type of the target.
Takes an instance of a target object and returns a proxy object wrapping it
Helps identifying a reflection special name
Class helping identifying special names found with reflection
Similar to , but with automatic type registration is disabled.
Allows type automatic registration for the specified type.
NOTE: automatic type registration is NOT recommended.
The type.
True to register the type automatically, false otherwise.
The default registration policy used by MoonSharp unless explicitely replaced.
Deregistrations are allowed, but registration of a new descriptor are not allowed
if a descriptor is already registered for that type.
Automatic type registration is disabled.
Called to handle the registration or deregistration of a type descriptor. Must return the type descriptor to be registered, or null to remove the registration.
The new descriptor, or null if this is a deregistration.
The old descriptor, or null if no descriptor was previously registered for this type.
Allows type automatic registration for the specified type.
NOTE: automatic type registration is NOT recommended.
The type.
True to register the type automatically, false otherwise.
A registration policy which makes registration permanent and not deletable.
Deregistrations are not allowed and registrations of a new descriptor are not allowed
if a descriptor is already registered for that type.
Called to handle the registration or deregistration of a type descriptor. Must return the type descriptor to be registered, or null to remove the registration.
The new descriptor, or null if this is a deregistration.
The old descriptor, or null if no descriptor was previously registered for this type.
Allows type automatic registration for the specified type.
NOTE: automatic type registration is NOT recommended.
The type.
True to register the type automatically, false otherwise.
Interface for managing how to handle
Called to handle the registration or deregistration of a type descriptor. Must return the type descriptor to be registered, or null to remove the registration.
The new descriptor, or null if this is a deregistration.
The old descriptor, or null if no descriptor was previously registered for this type.
Allows type automatic registration for the specified type.
NOTE: automatic type registration is NOT recommended.
The type.
True to register the type automatically, false otherwise.
Member descriptor for indexer of array types
Initializes a new instance of the class.
The name.
if set to true is a setter indexer.
The indexer parameters.
Initializes a new instance of the class.
The name.
if set to true [is setter].
Prepares the descriptor for hard-wiring.
The descriptor fills the passed table with all the needed data for hardwire generators to generate the appropriate code.
The table to be filled
Data descriptor used for proxy objects
Gets the descriptor which describes the proxy object
Gets the name of the descriptor (usually, the name of the type described).
Gets the type this descriptor refers to
Proxies the specified object.
The object.
Performs an "index" "get" operation.
The script originating the request
The object (null if a static request is done)
The index.
If set to true, it's indexed with a name, if false it's indexed through brackets.
Performs an "index" "set" operation.
The script originating the request
The object (null if a static request is done)
The index.
The value to be set
If set to true, it's indexed with a name, if false it's indexed through brackets.
Converts this userdata to string
The object.
Gets a "meta" operation on this userdata. If a descriptor does not support this functionality,
it should return "null" (not a nil).
These standard metamethods can be supported (the return value should be a function accepting the
classic parameters of the corresponding metamethod):
__add, __sub, __mul, __div, __div, __pow, __unm, __eq, __lt, __le, __lt, __len, __concat,
__pairs, __ipairs, __iterator, __call
These standard metamethods are supported through other calls for efficiency:
__index, __newindex, __tostring
The script originating the request
The object (null if a static request is done)
The name of the metamember.
Determines whether the specified object is compatible with the specified type.
Unless a very specific behaviour is needed, the correct implementation is a
simple " return type.IsInstanceOfType(obj); "
The type.
The object.
Member descriptor which allows to define new members which behave similarly to class instance members
Initializes a new instance of the class.
A new member descriptor is defined, which is a function taking no parameters and returning void, doing nothing.
Name of the function.
Initializes a new instance of the class.
The function described by descriptors created by this callback are defined as if they take no parameters
and thus don't support overload resolution well (unless they really take no parameters) but can freely be
used if no overload resolution is required.
Name of the function.
The callback function.
Initializes a new instance of the class.
Members defined with this constructor will support overload resolution.
Name of the function.
The call back.
The parameters.
The internal callback which actually executes the method
The script.
The object.
The context.
The arguments.
Class providing easier marshalling of CLR functions
Gets a value indicating whether the described method is static.
Gets the name of the described method
Gets a sort discriminant to give consistent overload resolution matching in case of perfectly equal scores
Gets the type of the arguments of the underlying CLR function
Gets the type which this extension method extends, null if this is not an extension method.
Gets a value indicating the type of the ParamArray parameter of a var-args function. If the function is not var-args,
null is returned.
Gets a value indicating the type of the elements of the ParamArray parameter of a var-args function. If the function is not var-args,
null is returned.
Initializes this instance.
This *MUST* be called by the constructors extending this class to complete initialization.
Name of the function.
if set to true [is static].
The parameters.
if set to true [is extension method].
Gets a callback function as a delegate
The script for which the callback must be generated.
The object (null for static).
Gets the callback function.
The script for which the callback must be generated.
The object (null for static).
Gets the callback function as a DynValue.
The script for which the callback must be generated.
The object (null for static).
Creates a callback DynValue starting from a MethodInfo.
The script.
The mi.
The object.
Builds the argument list.
The script.
The object.
The context.
The arguments.
Output: A list containing the indices of all "out" parameters, or null if no out parameters are specified.
The arguments, appropriately converted.
Builds the return value of a call
The script.
The out parameters indices, or null. See .
The parameters passed to the function.
The return value from the function. Use DynValue.Void if the function returned no value.
A DynValue to be returned to scripts
The internal callback which actually executes the method
The script.
The object.
The context.
The arguments.
Gets the types of access supported by this member
Gets the value of this member as a to be exposed to scripts.
The script.
The object owning this member, or null if static.
The value of this member as a .
Sets the value.
The script.
The object.
The v.
Standard descriptor for Enum values
Gets the underlying type of the enum.
Gets a value indicating whether underlying type of the enum is unsigned.
Gets a value indicating whether this instance describes a flags enumeration.
Initializes a new instance of the class.
Type of the enum.
Name of the friendly.
enumType must be an enum!
Fills the member list.
Adds an enum method to the object
The name.
The dyn value.
Gets the value of the enum as a long
Gets the value of the enum as a ulong
Creates an enum value from a long
Creates an enum value from a ulong
Creates conversion functions for signed enums
Creates conversion functions for unsigned enums
Determines whether the specified object is compatible with the specified type.
The type.
The object.
Gets a "meta" operation on this userdata.
In this specific case, only the concat operator is supported, only on flags enums and it implements the
'or' operator.
Class providing a simple descriptor for constant DynValues in userdata
Initializes a new instance of the class.
The name.
A string containing a table whose first member is the dynvalue to be deserialized (convoluted...).
Initializes a new instance of the class.
The name.
Initializes a new instance of the class.
The name.
The value.
Gets a value indicating whether the described member is static.
Gets the name of the member
Gets the types of access supported by this member
Gets the value wrapped by this descriptor
Gets the value of this member as a to be exposed to scripts.
The script.
The object owning this member, or null if static.
The value of this member as a .
Sets the value of this member from a .
The script.
The object owning this member, or null if static.
The value to be set.
userdata '{0}' cannot be written to.
Prepares the descriptor for hard-wiring.
The descriptor fills the passed table with all the needed data for hardwire generators to generate the appropriate code.
The table to be filled
Class providing easier marshalling of CLR events. Handling is limited to a narrow range of handler signatures, which,
however, covers in practice most of all available events.
The maximum number of arguments supported in an event handler delegate
Tries to create a new StandardUserDataEventDescriptor, returning null in case the method is not
visible to script code.
The EventInfo.
The
A new StandardUserDataEventDescriptor or null.
Checks if the event is compatible with a standard descriptor
The EventInfo.
if set to true an exception with the proper error message is thrown if not compatible.
Thrown if throwException is true and one of this applies:
The event is declared in a value type
or
The event does not have both add and remove methods
or
The event handler type doesn't implement a public Invoke method
or
The event handler has a return type which is not System.Void
or
The event handler has more than MAX_ARGS_IN_DELEGATE parameters
or
The event handler has a value type parameter or a by ref parameter
or
The event handler signature is not a valid method according to
Initializes a new instance of the class.
The ei.
The access mode.
Gets the EventInfo object of the event described by this descriptor
Gets a value indicating whether the event described by this descriptor is static.
Gets a dynvalue which is a facade supporting add/remove methods which is callable from scripts
The script.
The object for which the facade should be written.
Gets the name of the member
Gets the types of access supported by this member
Sets the value.
The script.
The object.
The v.
Class providing easier marshalling of overloaded CLR functions
Comparer class for IOverloadableMemberDescriptor
Gets or sets a value indicating whether this instance ignores extension methods.
Initializes a new instance of the class.
Initializes a new instance of the class.
The name.
The declaring type.
The descriptor of the first overloaded method.
Initializes a new instance of the class.
The name.
The declaring type.
The descriptors of the overloaded methods.
Sets the extension methods snapshot.
The version.
The ext methods.
Gets the name of the first described overload
Gets the name of the first described overload
Adds an overload.
The overload.
Gets the number of overloaded methods contained in this collection
The overload count.
Performs the overloaded call.
The script.
The object.
The context.
The arguments.
function call doesn't match any overload
Calculates the score for the overload.
The context.
The arguments.
The method.
if set to true, is an extension method.
Gets a callback function as a delegate
The script for which the callback must be generated.
The object (null for static).
Gets the callback function.
The script for which the callback must be generated.
The object (null for static).
Gets a value indicating whether there is at least one static method in the resolution list
Gets the types of access supported by this member
Gets the value of this member as a to be exposed to scripts.
The script.
The object owning this member, or null if static.
The value of this member as a .
Sets the value of this member from a .
The script.
The object owning this member, or null if static.
The value to be set.
Prepares the descriptor for hard-wiring.
The descriptor fills the passed table with all the needed data for hardwire generators to generate the appropriate code.
The table to be filled
Class providing easier marshalling of CLR fields
Gets the FieldInfo got by reflection
Gets the
Gets a value indicating whether the described property is static.
Gets the name of the property
Gets a value indicating whether this instance is a constant
Gets a value indicating whether this instance is readonly
Tries to create a new StandardUserDataFieldDescriptor, returning null in case the field is not
visible to script code.
The FieldInfo.
The
A new StandardUserDataFieldDescriptor or null.
Initializes a new instance of the class.
The FieldInfo.
The
Gets the value of the property
The script.
The object.
Sets the value of the property
The script.
The object.
The value to set.
Gets the types of access supported by this member
Prepares the descriptor for hard-wiring.
The descriptor fills the passed table with all the needed data for hardwire generators to generate the appropriate code.
The table to be filled
Member descriptor for the default constructor of value types.
Gets a value indicating whether the described method is static.
Gets the name of the described method
This property is equal to the value type to be constructed.
Gets the type of the arguments of the underlying CLR function
Gets the type which this extension method extends, null if this is not an extension method.
Gets a value indicating the type of the ParamArray parameter of a var-args function. If the function is not var-args,
null is returned.
Gets a value indicating the type of the elements of the ParamArray parameter of a var-args function. If the function is not var-args,
null is returned.
Initializes a new instance of the
class
representing the default empty ctor for a value type.
Type of the value.
valueType is not a value type
Invokes the member from script.
Implementors should raise exceptions if the value cannot be executed or if access to an
instance member through a static userdata is attempted.
The script.
The object.
The context.
The arguments.
Gets a sort discriminant to give consistent overload resolution matching in case of perfectly equal scores
Gets the types of access supported by this member
Gets the value of this member as a
to be exposed to scripts.
Implementors should raise exceptions if the value cannot be read or if access to an
instance member through a static userdata is attempted.
The script.
The object owning this member, or null if static.
The value of this member as a .
Sets the value of this member from a
.
Implementors should raise exceptions if the value cannot be read or if access to an
instance member through a static userdata is attempted.
The script.
The object owning this member, or null if static.
The value to be set.
Prepares the descriptor for hard-wiring.
The descriptor fills the passed table with all the needed data for hardwire generators to generate the appropriate code.
The table to be filled
Standard user data descriptor used to instantiate generics.
Gets the interop access mode this descriptor uses for members access
Initializes a new instance of the class.
The type this descriptor refers to.
The interop access mode this descriptor uses for members access
Registry of all extension methods. Use UserData statics to access these.
Registers an extension Type (that is a type containing extension methods)
The type.
The InteropAccessMode.
Gets all the extension methods which can match a given name
The name.
Gets a number which gets incremented everytime the extension methods registry changes.
Use this to invalidate caches based on extension methods
Gets all the extension methods which can match a given name and extending a given Type
The name.
The extended type.
Registry of all type descriptors. Use UserData statics to access these.
Registers all types marked with a MoonSharpUserDataAttribute that ar contained in an assembly.
The assembly.
if set to true extension types are registered to the appropriate registry.
Determines whether the specified type is registered. Note that this should be used only to check if a descriptor
has been registered EXACTLY. For many types a descriptor can still be created, for example through the descriptor
of a base type or implemented interfaces.
The type
Unregisters a type.
WARNING: unregistering types at runtime is a dangerous practice and may cause unwanted errors.
Use this only for testing purposes or to re-register the same type in a slightly different way.
Additionally, it's a good practice to discard all previous loaded scripts after calling this method.
The The type to be unregistered
Gets or sets the default access mode to be used in the whole application
The default access mode.
InteropAccessMode is InteropAccessMode.Default
Registers a proxy type.
The proxy factory.
The access mode.
Name of the friendly.
Registers a type
The type.
The access mode (used only if a default type descriptor is created).
Friendly name of the descriptor.
The descriptor, or null to use a default one.
Resolves the default type of the access mode for the given type
The access mode.
The type.
Gets the best possible type descriptor for a specified CLR type.
The CLR type for which the descriptor is desired.
if set to true interfaces are used in the search.
Determines whether the specified type is blacklisted.
Blacklisted types CANNOT be registered using default descriptors but they can still be registered
with custom descriptors. Forcing registration of blacklisted types in this way can introduce
side effects.
The t.
Gets the list of registered types.
The registered types.
Gets the list of registered types, including unregistered types.
The registered types.
Gets or sets the registration policy.
Collection of the standard policies to handle UserData type registrations.
Provided mostly for compile-time backward compatibility with old code.
See also : .
The default registration policy used by MoonSharp unless explicitely replaced.
Deregistrations are allowed, but registration of a new descriptor are not allowed
if a descriptor is already registered for that type.
Types must be explicitly registered.
The default registration policy used by MoonSharp unless explicitely replaced.
Deregistrations are allowed, but registration of a new descriptor are not allowed
if a descriptor is already registered for that type.
Types must be explicitly registered.
Types are automatically registered if not found in the registry. This is easier to use but potentially unsafe.
As a convenience, every type deriving from IUserDataType is "self-described". That is, no descriptor is needed/generated
and the object itself is used to describe the type for interop. See also ,
and .
Performs an "index" "get" operation.
The script originating the request
The index.
If set to true, it's indexed with a name, if false it's indexed through brackets.
Performs an "index" "set" operation.
The script originating the request
The index.
The value to be set
If set to true, it's indexed with a name, if false it's indexed through brackets.
Gets a "meta" operation on this userdata. If a descriptor does not support this functionality,
it should return "null" (not a nil).
These standard metamethods can be supported (the return value should be a function accepting the
classic parameters of the corresponding metamethod):
__add, __sub, __mul, __div, __div, __pow, __unm, __eq, __lt, __le, __lt, __len, __concat,
__pairs, __ipairs, __iterator, __call
These standard metamethods are supported through other calls for efficiency:
__index, __newindex, __tostring
The script originating the request
The name of the metamember.
Internal type used by for registration
Wrapper which allows for easier management of userdata without registering a new userdata type - useful
if a type which is not exposed to scripts but can be managed as a "black box" by scripts is desired.
The type to wrap
Initializes a new instance of the class.
Initializes a new instance of the class.
The o.
Gets or sets the value this instance wraps.
Interface used by MoonSharp to access objects of a given type from scripts.
Gets the name of the descriptor (usually, the name of the type described).
Gets the type this descriptor refers to
Performs an "index" "get" operation.
The script originating the request
The object (null if a static request is done)
The index.
If set to true, it's indexed with a name, if false it's indexed through brackets.
Performs an "index" "set" operation.
The script originating the request
The object (null if a static request is done)
The index.
The value to be set
If set to true, it's indexed with a name, if false it's indexed through brackets.
Converts this userdata to string
The object.
Gets a "meta" operation on this userdata. If a descriptor does not support this functionality,
it should return "null" (not a nil).
These standard metamethods can be supported (the return value should be a function accepting the
classic parameters of the corresponding metamethod):
__add, __sub, __mul, __div, __div, __pow, __unm, __eq, __lt, __le, __lt, __len, __concat,
__pairs, __ipairs, __iterator, __call
These standard metamethods are supported through other calls for efficiency:
__index, __newindex, __tostring
The script originating the request
The object (null if a static request is done)
The name of the metamember.
Determines whether the specified object is compatible with the specified type.
Unless a very specific behaviour is needed, the correct implementation is a
simple " return type.IsInstanceOfType(obj); "
The type.
The object.
Classes using the classic interface should inherit from this class.
This class defines only static methods and is really meant to be used only
from C# and not other .NET languages.
For easier operation they should also define:
using ptrdiff_t = System.Int32;
using lua_Integer = System.Int32;
using LUA_INTFRM_T = System.Int64;
using UNSIGNED_LUA_INTFRM_T = System.UInt64;
Calls a function.
To call a function you must use the following protocol: first, the function to be called is pushed onto the stack; then,
the arguments to the function are pushed in direct order; that is, the first argument is pushed first. Finally you call
lua_call; nargs is the number of arguments that you pushed onto the stack. All arguments and the function value are
popped from the stack when the function is called. The function results are pushed onto the stack when the function
returns. The number of results is adjusted to nresults, unless nresults is LUA_MULTRET. In this case, all results from
the function are pushed. Lua takes care that the returned values fit into the stack space. The function results are
pushed onto the stack in direct order (the first result is pushed first), so that after the call the last result is on
the top of the stack.
The LuaState
The number of arguments.
The number of expected results.
Determines whether the specified value is of numeric type.
The object to check.
true if o is a numeric type; otherwise, false.
Determines whether the specified value is positive.
The value.
if set to true treats 0 as positive.
true if the specified value is positive; otherwise, false.
Converts the specified values boxed type to its correpsonding unsigned
type.
The value.
A boxed numeric object whos type is unsigned.
Converts the specified values boxed type to its correpsonding integer
type.
The value.
if set to true [round].
A boxed numeric object whos type is an integer type.
Replaces the string representations of meta chars with their corresponding
character values.
The input.
A string with all string meta chars are replaced
Namespace containing classes used to provide a minimal support for porting code based on the classic
"LuaState" model (e.g. code based on KopiLua, UniLua or Lua itself).
Wrappers for enumerables as return types
Forces a class member visibility to scripts. Can be used to hide public members or to expose non-public ones.
Gets a value indicating whether this is set to "visible".
Initializes a new instance of the class.
if set to true the member will be exposed to scripts, if false the member will be hidden.
A user data descriptor which aggregates multiple descriptors and tries dispatching members
on them, in order.
Used, for example, for objects implementing multiple interfaces but for which no descriptor is
specifically registered.
Initializes a new instance of the class.
The descriptors.
The type.
Gets the descriptors aggregated by this object, allowing changes to the descriptor list
Gets the name of the descriptor (usually, the name of the type described).
Gets the type this descriptor refers to
Performs an "index" "get" operation.
The script originating the request
The object (null if a static request is done)
The index.
If set to true, it's indexed with a name, if false it's indexed through brackets.
Performs an "index" "set" operation.
The script originating the request
The object (null if a static request is done)
The index.
The value to be set
If set to true, it's indexed with a name, if false it's indexed through brackets.
Converts this userdata to string
The object.
Gets a "meta" operation on this userdata. If a descriptor does not support this functionality,
it should return "null" (not a nil).
These standard metamethods can be supported (the return value should be a function accepting the
classic parameters of the corresponding metamethod):
__add, __sub, __mul, __div, __div, __pow, __unm, __eq, __lt, __le, __lt, __len, __concat,
__pairs, __ipairs, __iterator, __call
These standard metamethods are supported through other calls for efficiency:
__index, __newindex, __tostring
The script originating the request
The object (null if a static request is done)
The name of the metamember.
Determines whether the specified object is compatible with the specified type.
Unless a very specific behaviour is needed, the correct implementation is a
simple " return type.IsInstanceOfType(obj); "
The type.
The object.
Standard descriptor for userdata types.
Gets the interop access mode this descriptor uses for members access
Initializes a new instance of the class.
The type this descriptor refers to.
The interop access mode this descriptor uses for members access
A human readable friendly name of the descriptor.
Fills the member list.
Class providing easier marshalling of CLR functions
Gets the method information (can be a MethodInfo or ConstructorInfo)
Gets the access mode used for interop
Gets a value indicating whether the described method is a constructor
Initializes a new instance of the class.
The MethodBase (MethodInfo or ConstructorInfo) got through reflection.
The interop access mode.
Invalid accessMode
Tries to create a new MethodMemberDescriptor, returning
null in case the method is not
visible to script code.
The MethodBase.
The
if set to true forces visibility.
A new MethodMemberDescriptor or null.
Checks if the method is compatible with a standard descriptor
The MethodBase.
if set to true an exception with the proper error message is thrown if not compatible.
Thrown if throwException is true and one of this applies:
The method contains unresolved generic parameters, or has an unresolved generic return type
or
The method contains pointer parameters, or has a pointer return type
The internal callback which actually executes the method
The script.
The object.
The context.
The arguments.
Called by standard descriptors when background optimization or preoptimization needs to be performed.
Out/Ref params cannot be precompiled.
Prepares the descriptor for hard-wiring.
The descriptor fills the passed table with all the needed data for hardwire generators to generate the appropriate code.
The table to be filled
Class providing easier marshalling of CLR properties
Gets the PropertyInfo got by reflection
Gets the
Gets a value indicating whether the described property is static.
Gets the name of the property
Gets a value indicating whether this instance can be read from
true if this instance can be read from; otherwise, false.
Gets a value indicating whether this instance can be written to.
true if this instance can be written to; otherwise, false.
Tries to create a new StandardUserDataPropertyDescriptor, returning null in case the property is not
visible to script code.
The PropertyInfo.
The
A new StandardUserDataPropertyDescriptor or null.
Initializes a new instance of the class.
NOTE: This constructor gives get/set visibility based exclusively on the CLR visibility of the
getter and setter methods.
The pi.
The access mode.
Initializes a new instance of the class.
The PropertyInfo.
The
The getter method. Use null to make the property writeonly.
The setter method. Use null to make the property readonly.
Gets the value of the property
The script.
The object.
Sets the value of the property
The script.
The object.
The value to set.
Gets the types of access supported by this member
Called by standard descriptors when background optimization or preoptimization needs to be performed.
Prepares the descriptor for hard-wiring.
The descriptor fills the passed table with all the needed data for hardwire generators to generate the appropriate code.
The table to be filled
Namespace containing classes used to customize and support advanced interoperations between
scripts and CLR code.
"Optimized" BinaryReader which shares strings and use a dumb compression for integers
"Optimized" BinaryWriter which shares strings and use a dumb compression for integers
An adapter over Stream which bypasses the Dispose and Close methods.
Used to work around the pesky wrappers .NET has over Stream (BinaryReader, StreamWriter, etc.) which think they
own the Stream and close them when they shouldn't. Damn.
A Delegate type which can wrap a script function
The arguments.
The return value of the script function
A Delegate type which can wrap a script function with a generic typed return value
The arguments.
The return value of the script function
Flags to alter the way the DynValue.CheckType and other related functions operate on data types for
validation.
No type validation specific behaviour
Nil and Void values are allowed (and returned by the call)
Simple autoconversions are attempted:
1) Numbers are convertible to strings
2) Strings are convertible to numbers if they contain a number
3) Everything is convertible to boolean (with void and nil converting to 'false', everything else converting to 'true')
Note: if both AutoConvert and AllowNil are specified, nils will NOT be converted to false booleans.
The default : Autoconverting values, no nils.
Exception thrown when a dynamic expression is invalid
Initializes a new instance of the class.
The format.
The arguments.
Initializes a new instance of the class.
The message.
Represents a dynamic expression in the script
The code which generated this expression
Evaluates the expression
The context.
Finds a symbol in the expression
The context.
Gets the script owning this resource.
The script owning this resource.
Determines whether this instance is a constant expression
Returns a hash code for this instance.
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Determines whether the specified , is equal to this instance.
The to compare with this instance.
true if the specified is equal to this instance; otherwise, false.
Extension methods used in the whole project.
Gets a value from the dictionary or returns the default value
The type of the key.
The type of the value.
The dictionary.
The key.
Gets a value from the dictionary or creates it
The type of the key.
The type of the value.
The dictionary.
The key.
A function which will create the value if it doesn't exist.
A class representing a script coroutine
Possible types of coroutine
A valid coroutine
A CLR callback assigned to a coroutine.
A CLR callback assigned to a coroutine and already executed.
Gets the type of coroutine
Gets this coroutine as a typed enumerable which can be looped over for resuming.
Returns its result as DynValue(s)
Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead
Gets this coroutine as a typed enumerable which can be looped over for resuming.
Returns its result as System.Object. Only the first element of tuples is returned.
Only non-CLR coroutines can be resumed with this method. Use an overload of the Resume method accepting a ScriptExecutionContext instead.
Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead
Gets this coroutine as a typed enumerable which can be looped over for resuming.
Returns its result as the specified type. Only the first element of tuples is returned.
Only non-CLR coroutines can be resumed with this method. Use an overload of the Resume method accepting a ScriptExecutionContext instead.
Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead
The purpose of this method is to convert a MoonSharp/Lua coroutine to a Unity3D coroutine.
This loops over the coroutine, discarding returned values, and returning null for each invocation.
This means however that the coroutine will be invoked each frame.
Only non-CLR coroutines can be resumed with this method. Use an overload of the Resume method accepting a ScriptExecutionContext instead.
Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead
Resumes the coroutine.
Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead.
The arguments.
Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead
Resumes the coroutine.
The ScriptExecutionContext.
The arguments.
Resumes the coroutine.
Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead.
Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead
Resumes the coroutine.
The ScriptExecutionContext.
Resumes the coroutine.
Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead.
The arguments.
Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead.
Resumes the coroutine
The ScriptExecutionContext.
The arguments.
Gets the coroutine state.
Gets the coroutine stack trace for debug purposes
The skip.
The entry source reference.
Gets the script owning this resource.
The script owning this resource.
Gets or sets the automatic yield counter.
The automatic yield counter.
Common interface for all resources which are uniquely bound to a script.
Gets the script owning this resource.
The script owning this resource.
A base class for many MoonSharp objects.
Helds a ReferenceID property which gets a different value for every object instance, for debugging
purposes. Note that the ID is not assigned in a thread safe manner for speed reason, so the IDs
are guaranteed to be unique only if everything is running on one thread at a time.
Gets the reference identifier.
The reference identifier.
Formats a string with a type name and a ref-id
The type name.
Class used to support "tail" continuations - a way for C# / Lua interaction which supports
coroutine yielding (at the expense of a LOT of added complexity in calling code).
Gets or sets the function to call
Gets or sets the arguments to the function
Gets or sets the callback to be used as a continuation.
Gets or sets the callback to be used in case of errors.
Gets or sets the error handler to be called before stack unwinding
Class exposing C# objects as Lua userdata.
For efficiency, a global registry of types is maintained, instead of a per-script one.
Gets or sets the "uservalue". See debug.getuservalue and debug.setuservalue.
http://www.lua.org/manual/5.2/manual.html#pdf-debug.setuservalue
Gets the object associated to this userdata (null for statics)
Gets the type descriptor of this userdata
Registers a type for userdata interop
The type to be registered
The access mode (optional).
Friendly name for the type (optional)
Registers a type for userdata interop
The type to be registered
The access mode (optional).
Friendly name for the type (optional)
Registers a proxy type.
The proxy factory.
The access mode.
A friendly name for the descriptor.
Registers a proxy type using a delegate.
The type of the proxy.
The type of the target.
A delegate creating a proxy object from a target object.
The access mode.
A friendly name for the descriptor.
Registers a type with a custom userdata descriptor
The type to be registered
The custom descriptor.
Registers a type with a custom userdata descriptor
The type to be registered
The custom descriptor.
Registers a type with a custom userdata descriptor
The custom descriptor.
Registers all types marked with a MoonSharpUserDataAttribute that ar contained in an assembly.
The assembly.
if set to true extension types are registered to the appropriate registry.
Determines whether the specified type is registered. Note that this should be used only to check if a descriptor
has been registered EXACTLY. For many types a descriptor can still be created, for example through the descriptor
of a base type or implemented interfaces.
The type.
Determines whether the specified type is registered. Note that this should be used only to check if a descriptor
has been registered EXACTLY. For many types a descriptor can still be created, for example through the descriptor
of a base type or implemented interfaces.
The type.
Unregisters a type.
WARNING: unregistering types at runtime is a dangerous practice and may cause unwanted errors.
Use this only for testing purposes or to re-register the same type in a slightly different way.
Additionally, it's a good practice to discard all previous loaded scripts after calling this method.
The type to be unregistered
Unregisters a type.
WARNING: unregistering types at runtime is a dangerous practice and may cause unwanted errors.
Use this only for testing purposes or to re-register the same type in a slightly different way.
Additionally, it's a good practice to discard all previous loaded scripts after calling this method.
The The type to be unregistered
Creates a userdata DynValue from the specified object, using a specific descriptor
The object
The descriptor.
Creates a userdata DynValue from the specified object
The object
Creates a static userdata DynValue from the specified IUserDataDescriptor
The IUserDataDescriptor
Creates a static userdata DynValue from the specified Type
The type
Creates a static userdata DynValue from the specified Type
The Type
Gets or sets the registration policy to be used in the whole application
Gets or sets the default access mode to be used in the whole application
The default access mode.
InteropAccessMode is InteropAccessMode.Default
Registers an extension Type (that is a type containing extension methods)
The type.
The InteropAccessMode.
Gets all the extension methods which can match a given name and extending a given Type
The name.
The extended type.
Gets a number which gets incremented everytime the extension methods registry changes.
Use this to invalidate caches based on extension methods
Gets the best possible type descriptor for a specified CLR type.
The CLR type for which the descriptor is desired.
if set to true interfaces are used in the search.
Gets the best possible type descriptor for a specified CLR type.
The CLR type for which the descriptor is desired.
if set to true interfaces are used in the search.
Gets the best possible type descriptor for a specified CLR object.
The object.
Gets a table with the description of registered types.
if set to true, it will also include the last found descriptor of all unregistered types.
Gets all the registered types.
if set to true, it will also include the last found descriptor of all unregistered types.
Constants of well known "symbols" in the MoonSharp grammar
The variadic argument symbol ("...")
The environment symbol ("_ENV")
Class wrapping a request to yield a coroutine
The return values of the coroutine
Gets or sets a value indicating whether this is a forced yield.
Wrapper for a debugger initiated action
Type of the action
Step-in at the bytecode level
Step-over at the bytecode level
Step-out at the bytecode level
Step-in at the source level
Step-over at the source level
Step-out at the source level
Continue execution "freely"
Toggles breakpoint
Sets a breakpoint
Clears a breakpoint
Refresh the data
Hard refresh of data
No action
The type of action
Gets the time stamp UTC of this action
Gets or sets the source identifier this action refers to.
Gets or sets the source line this action refers to.
Gets or sets the source column this action refers to.
Initializes a new instance of the class.
Gets the age of this debugger action
Returns a that represents this instance.
A that represents this instance.
Interface for debuggers to implement, in order to provide debugging facilities to Scripts.
Called by the script engine when a source code is added or changed.
The source code object.
Called by the script engine when the bytecode changes.
The bytecode source
Called by the script engine at execution time to check if a break has
been requested. Should return pretty fast as it's called A LOT.
Called by the script engine when a runtime error occurs.
The debugger can return true to signal the engine that it wants to break
into the source of the error. If it does so, it should also return true
to subsequent calls to IsPauseRequested().
The runtime exception.
True if this error should break execution.
Called by the script engine to get what action to do next.
The instruction pointer in bytecode.
The source reference.
T
Called by the script engine when the execution ends.
Called by the script engine to update watches of a given type. Note
that this method is not called only for watches in the strictest term,
but also for the stack, etc.
Type of the watch.
The items.
Called by the script engine to get which expressions are active
watches in the debugger.
A list of watches
Called by the script engine to refresh the breakpoint list.
Class representing a reference to source code interval
Gets a value indicating whether this location is inside CLR .
Gets the index of the source.
Gets from which column the source code ref starts
Gets to which column the source code ref ends
Gets from which line the source code ref starts
Gets to which line the source code ref ends
Gets a value indicating whether this instance is a stop "step" in source mode
Gets a value indicating whether this instance is a breakpoint
Gets a value indicating whether this instance cannot be set as a breakpoint
Returns a that represents this instance.
A that represents this instance.
Gets whether the source ref includes the specified location
Index of the source.
The line.
The column.
Sets the CannotBreakpoint flag.
Formats the location according to script preferences
The script.
if set to true the classic Lua format is forced.
A watch item for the debugger to consume.
Most properties make or not sense depending on the WatchType.
Gets or sets the address of the item
Gets or sets the base pointer (base value of v-stack at entering the function).
Valid only for call-stack items
Gets or sets the return address.
Valid only for call-stack items
Gets or sets the name of the item
Gets or sets the value of the item
Gets or sets the symbol reference of the item
Gets or sets a value indicating whether this instance is generating an error.
Gets or sets the source location this item refers to.
Returns a that represents this instance.
A that represents this instance.
Enumeration of the possible watch types
A real variable watch
The status of the v-stack
The call stack
The list of coroutines
The maximum value of this enum
Class representing the source code of a given script
Gets the name of the source code
Gets the source code as a string
Gets the source code lines.
Gets the script owning this resource.
Gets the source identifier inside a script
Gets the code snippet represented by a source ref
The source code reference.
Namespace containing classes used to support debuggers
This class is not *really* IDisposable.. it's just use to have a RAII like pattern.
You are free to reuse this instance after calling Dispose.
This class is not *really* IDisposable.. it's just use to have a RAII like pattern.
You are free to reuse this instance after calling Dispose.
Enumeration of the possible performance counters
Measures the time spent parsing the source creating the AST
Measures the time spent converting ASTs in bytecode
Measures the time spent in executing scripts
Measures the on the fly creation/compilation of functions in userdata descriptors
Sentinel value to get the enum size
Enumeration of unit of measures of the performance counters
The performance counter is specified in bytes (of memory)
The performance counter is specified in milliseconds
A single object of this type exists for every script and gives access to performance statistics.
Gets or sets a value indicating whether this collection of performance stats is enabled.
true if enabled; otherwise, false.
Gets the result of the specified performance counter .
The PerformanceCounter.
Starts a stopwatch.
Starts a stopwatch.
Gets a string with a complete performance log.
The result of a performance counter
Gets the name of the performance counter which generated this result.
Gets the quantity monitored - see Type to understand what this field contains
Gets the number of instances which led to the specified counter being incremented - e.g. the times a specific
code is executed, or object instanced
Gets a value indicating whether this is global or relative to the resource
for which it's called.
Gets the unit of measure of the Counter field.
Returns a that represents this instance.
Converts a PerformanceCounterType to a string.
The type.
Namespace containing classes used to support self diagnostics (e.g. performance counters)
Exception for all runtime errors. In addition to constructors, it offers a lot of static methods
generating more "standard" Lua errors.
Initializes a new instance of the class.
The ex.
Initializes a new instance of the class.
The message that describes the error.
Initializes a new instance of the class.
The format.
The arguments.
Gets or sets a value indicating whether the message should not be decorated
Creates a ScriptRuntimeException with a predefined error message specifying that
an arithmetic operation was attempted on non-numbers
The left operand.
The right operand (or null).
The exception to be raised.
If both are numbers
Creates a ScriptRuntimeException with a predefined error message specifying that
a concat operation was attempted on non-strings
The left operand.
The right operand.
The exception to be raised.
If both are numbers or strings
Creates a ScriptRuntimeException with a predefined error message specifying that
a len operator was applied on an invalid operand
The operand.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
a comparison operator was applied on an invalid combination of operand types
The left operand.
The right operand.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
a function was called with a bad argument
The argument number (0-based).
Name of the function generating this error.
The error message.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
a function was called with a bad userdata argument
The argument number (0-based).
Name of the function generating this error.
The expected System.Type.
The object which was used.
True if nils were allowed in this call.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
a function was called with a bad argument
The argument number (0-based).
Name of the function generating this error.
The expected data type.
The data type received.
True if nils were allowed in this call.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
a function was called with a bad argument
The argument number (0-based).
Name of the function generating this error.
The expected type description.
The description of the type received.
True if nils were allowed in this call.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
a function was called with no value when a value was required.
This function creates a message like "bad argument #xxx to 'yyy' (zzz expected, got no value)"
while creates a message like "bad argument #xxx to 'yyy' (value expected)"
The argument number (0-based).
Name of the function generating this error.
The expected data type.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
an out of range index was specified
The argument number (0-based).
Name of the function generating this error.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
a function was called with a negative number when a positive one was expected.
The argument number (0-based).
Name of the function generating this error.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
a function was called with no value when a value was required.
This function creates a message like "bad argument #xxx to 'yyy' (value expected)"
while creates a message like "bad argument #xxx to 'yyy' (zzz expected, got no value)"
The argument number (0-based).
Name of the function generating this error.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
an invalid attempt to index the specified object was made
The object.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
a loop was detected when performing __index over metatables.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
a loop was detected when performing __newindex over metatables.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
a loop was detected when performing __call over metatables.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
a table indexing operation used nil as the key.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
a table indexing operation used a NaN as the key.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
a conversion to number failed.
Selects the correct error message:
0 - "value must be a number"
1 - "'for' initial value must be a number"
2 - "'for' step must be a number"
3 - "'for' limit must be a number"
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
a conversion of a CLR type to a Lua type has failed.
The object which could not be converted.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
a conversion of a Lua type to a CLR type has failed.
The Lua type.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
a constrained conversion of a Lua type to a CLR type has failed.
The Lua type.
The expected CLR type.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
a userdata of a specific CLR type was expected and a non-userdata type was passed.
The Lua type.
The expected CLR type.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
an attempt to index an invalid member of a userdata was done.
The name of the userdata type.
The field name.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
an attempt resume a coroutine in an invalid state was done.
The state of the coroutine.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
an attempt to yield across a CLR boundary was made.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
an attempt to yield from the main coroutine was made.
The exception to be raised.
Creates a ScriptRuntimeException with a predefined error message specifying that
an attempt to call a non-function was made
The lua non-function data type.
The debug text to aid location (appears as "near 'xxx'").
Creates a ScriptRuntimeException with a predefined error message specifying that
an attempt to access a non-static member from a static userdata was made
The member descriptor.
Creates a ScriptRuntimeException with a predefined error message specifying that
an attempt to access a non-static member from a static userdata was made
The type descriptor.
The member descriptor.
Exception thrown when an inconsistent state is reached in the interpreter
Base type of all exceptions thrown in MoonSharp
Initializes a new instance of the class.
The ex.
Initializes a new instance of the class.
The message that describes the error.
Initializes a new instance of the class.
The format.
The arguments.
Gets the instruction pointer of the execution (if it makes sense)
Gets the interpreter call stack.
Gets the decorated message (error message plus error location in script) if possible.
Exception for all parsing/lexing errors.
Gets or sets a value indicating whether this exception was caused by premature stream termination (that is, unexpected EOF).
This can be used in REPL interfaces to tell between unrecoverable errors and those which can be recovered by extra input.
This class is a container for arguments received by a CallbackFunction
Initializes a new instance of the class.
The arguments.
if set to true [is method call].
Gets the count of arguments
Gets or sets a value indicating whether this is a method call.
Gets the at the specified index, or Void if not found
Gets the at the specified index, or null.
The index.
if set to true all voids are translated to nils.
Converts the arguments to an array
The number of elements to skip (default= 0).
Gets the specified argument as as an argument of the specified type. If not possible,
an exception is raised.
The argument number.
Name of the function.
The type desired.
if set to true nil values are allowed.
Gets the specified argument as as an argument of the specified user data type. If not possible,
an exception is raised.
The desired userdata type
The argument number.
Name of the function.
if set to true nil values are allowed.
Gets the specified argument as an integer
The argument number.
Name of the function.
Gets the specified argument as a long integer
The argument number.
Name of the function.
Gets the specified argument as a string, calling the __tostring metamethod if needed, in a NON
yield-compatible way.
The execution context.
The argument number.
Name of the function.
'tostring' must return a string to '{0}'
Returns a copy of CallbackArguments where the first ("self") argument is skipped if this was a method call,
otherwise returns itself.
A class representing a script function
Type of closure based on upvalues
The closure has no upvalues (thus, technically, it's a function and not a closure!)
The closure has _ENV as its only upvalue
The closure is a "real" closure, with multiple upvalues
Gets the entry point location in bytecode .
Gets the script owning this function
Shortcut for an empty closure
The current closure context
Initializes a new instance of the class.
The script.
The index.
The symbols.
The resolved locals.
Calls this function with the specified args
Thrown if function is not of DataType.Function
Calls this function with the specified args
The arguments to pass to the function.
Thrown if function is not of DataType.Function
Calls this function with the specified args
The arguments to pass to the function.
Thrown if function is not of DataType.Function
Gets a delegate wrapping calls to this scripted function
Gets a delegate wrapping calls to this scripted function
The type of return value of the delegate.
Gets the number of upvalues in this closure
The number of upvalues in this closure
Gets the name of the specified upvalue.
The index of the upvalue.
The upvalue name
Gets the value of an upvalue. To set the value, use GetUpvalue(idx).Assign(...);
The index of the upvalue.
The value of an upvalue
Gets the type of the upvalues contained in this closure
This class wraps a CLR function
Gets the name of the function
Gets the call back.
The call back.
Initializes a new instance of the class.
The callback function to be called.
The callback name, used in stacktraces, debugger, etc..
Invokes the callback function
The execution context.
The arguments.
if set to true this is a method call.
Gets or sets the default access mode used when marshalling delegates
The default access mode. Default, HideMembers and BackgroundOptimized are NOT supported.
Default, HideMembers and BackgroundOptimized are NOT supported.
Creates a CallbackFunction from a delegate.
The script.
The delegate.
The access mode.
Creates a CallbackFunction from a MethodInfo relative to a function.
The script.
The MethodInfo object.
The object to which the function applies, or null for static methods.
The access mode.
The method is not static.
Gets or sets an object used as additional data to the callback function (available in the execution context).
Checks the callback signature of a method is compatible for callbacks
A class representing a value in a Lua/MoonSharp script.
Gets a unique reference identifier. This is guaranteed to be unique only for dynvalues created in a single thread as it's not thread-safe.
Gets the type of the value.
Gets the function (valid only if the is )
Gets the numeric value (valid only if the is )
Gets the values in the tuple (valid only if the is Tuple).
This field is currently also used to hold arguments in values whose is .
Gets the coroutine handle. (valid only if the is Thread).
Gets the table (valid only if the is )
Gets the boolean value (valid only if the is )
Gets the string value (valid only if the is )
Gets the CLR callback (valid only if the is )
Gets the tail call data.
Gets the yield request data.
Gets the tail call data.
Returns true if this instance is write protected.
Creates a new writable value initialized to Nil.
Creates a new writable value initialized to the specified boolean.
Creates a new writable value initialized to the specified number.
Creates a new writable value initialized to the specified string.
Creates a new writable value initialized to the specified StringBuilder.
Creates a new writable value initialized to the specified string using String.Format like syntax
Creates a new writable value initialized to the specified coroutine.
Internal use only, for external use, see Script.CoroutineCreate
The coroutine object.
Creates a new writable value initialized to the specified closure (function).
Creates a new writable value initialized to the specified CLR callback.
Creates a new writable value initialized to the specified CLR callback.
See also CallbackFunction.FromDelegate and CallbackFunction.FromMethodInfo factory methods.
Creates a new writable value initialized to the specified table.
Creates a new writable value initialized to an empty prime table (a
prime table is a table made only of numbers, strings, booleans and other
prime tables).
Creates a new writable value initialized to an empty table.
Creates a new writable value initialized to with array contents.
Creates a new request for a tail call. This is the preferred way to execute Lua/MoonSharp code from a callback,
although it's not always possible to use it. When a function (callback or script closure) returns a
TailCallRequest, the bytecode processor immediately executes the function contained in the request.
By executing script in this way, a callback function ensures it's not on the stack anymore and thus a number
of functionality (state savings, coroutines, etc) keeps working at full power.
The function to be called.
The arguments.
Creates a new request for a tail call. This is the preferred way to execute Lua/MoonSharp code from a callback,
although it's not always possible to use it. When a function (callback or script closure) returns a
TailCallRequest, the bytecode processor immediately executes the function contained in the request.
By executing script in this way, a callback function ensures it's not on the stack anymore and thus a number
of functionality (state savings, coroutines, etc) keeps working at full power.
The data for the tail call.
Creates a new request for a yield of the current coroutine.
The yield argumenst.
Creates a new request for a yield of the current coroutine.
The yield argumenst.
Creates a new tuple initialized to the specified values.
Creates a new tuple initialized to the specified values - which can be potentially other tuples
Creates a new userdata value
Returns this value as readonly - eventually cloning it in the process if it isn't readonly to start with.
Clones this instance.
Clones this instance, overriding the "readonly" status.
if set to true the new instance is set as readonly, or writeable otherwise.
Clones this instance, returning a writable copy.
Can't clone Symbol values
A preinitialized, readonly instance, equaling Void
A preinitialized, readonly instance, equaling Nil
A preinitialized, readonly instance, equaling True
A preinitialized, readonly instance, equaling False
Returns a string which is what it's expected to be output by the print function applied to this value.
Returns a that represents this instance.
A that represents this instance.
Returns a hash code for this instance.
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Determines whether the specified , is equal to this instance.
The to compare with this instance.
true if the specified is equal to this instance; otherwise, false.
Casts this DynValue to string, using coercion if the type is number.
The string representation, or null if not number, not string.
Casts this DynValue to a double, using coercion if the type is string.
The string representation, or null if not number, not string or non-convertible-string.
Casts this DynValue to a bool
False if value is false or nil, true otherwise.
Returns this DynValue as an instance of , if possible,
null otherwise
False if value is false or nil, true otherwise.
Converts a tuple to a scalar value. If it's already a scalar value, this function returns "this".
Performs an assignment, overwriting the value with the specified one.
The value.
If the value is readonly.
Gets the length of a string or table value.
Value is not a table or string.
Determines whether this instance is nil or void
Determines whether this instance is not nil or void
Determines whether this instance is void
Determines whether this instance is not void
Determines whether is nil, void or NaN (and thus unsuitable for using as a table key).
Changes the numeric value of a number DynValue.
Creates a new DynValue from a CLR object
The script.
The object.
Converts this MoonSharp DynValue to a CLR object.
Converts this MoonSharp DynValue to a CLR object of the specified type.
Checks the type of this value corresponds to the desired type. A propert ScriptRuntimeException is thrown
if the value is not of the specified type or - considering the TypeValidationFlags - is not convertible
to the specified type.
Name of the function requesting the value, for error message purposes.
The desired data type.
The argument number, for error message purposes.
The TypeValidationFlags.
Thrown
if the value is not of the specified type or - considering the TypeValidationFlags - is not convertible
to the specified type.
Checks if the type is a specific userdata type, and returns it or throws.
Name of the function.
The argument number.
The flags.
A class representing a key/value pair for Table use
Gets the key.
Gets or sets the value.
Initializes a new instance of the struct.
The key.
The value.
Gets the nil pair
Class giving access to details of the environment where the script is executing
Gets a value indicating whether this instance is running a dynamic execution.
Under a dynamic execution, most methods of ScriptExecutionContext are not reliable as the
processing engine of the script is not "really" running or is not available.
Gets the location of the code calling back
Gets or sets the additional data associated to this CLR function call.
Gets the metatable associated with the given value.
The value.
Gets the specified metamethod associated with the given value.
The value.
The metamethod name.
prepares a tail call request for the specified metamethod, or null if no metamethod is found.
Gets the metamethod to be used for a binary operation using op1 and op2.
Gets the script object associated with this request
Gets the coroutine which is performing the call
Calls a callback function implemented in "classic way".
Useful to port C code from Lua, or C# code from UniLua and KopiLua.
Lua : http://www.lua.org/
UniLua : http://github.com/xebecnan/UniLua
KopiLua : http://github.com/NLua/KopiLua
The arguments.
Name of the function - for error messages.
The callback.
Calls the specified function, supporting most cases. The called function must not yield.
The function; it must be a Function or ClrFunction or have a call metamethod defined.
The arguments.
If the function yields, returns a tail call request with continuations/handlers or, of course, if it encounters errors.
Tries to get the reference of a symbol in the current execution state
Tries to get the value of a symbol in the current execution state
Finds a symbol by name in the current execution state
Gets the current global env, or null if not found.
Performs a message decoration before unwinding after an error. To be used in the implementation of xpcall like functions.
The message handler.
The exception.
Gets the script owning this resource.
The script owning this resource.
State of coroutines
This is the main coroutine
Coroutine has not started yet
Coroutine is suspended
Coroutine has been forcefully suspended (i.e. auto-yielded)
Coroutine is running
Coroutine has terminated
LINQ helper methods
Converts the specified enumerable dynvalues of a given script type to objects of a given type
The desired type
The enumerable.
The type.
Filters an enumeration for items of the given script type
The enumerable.
The script type.
Converts the elements to CLR objects
The enumerable.
Converts the elements to CLR objects of the desired type
The desired type
The enumerable.
Marks a type of automatic registration as userdata (which happens only if UserData.RegisterAssembly is called).
The interop access mode
Initializes a new instance of the class.
Descriptor which acts as a non-containing adapter from IUserDataType to IUserDataDescriptor
Initializes a new instance of the class.
The type.
Name of the friendly.
Gets the name of the descriptor (usually, the name of the type described).
Gets the type this descriptor refers to
Performs an "index" "get" operation.
The script originating the request
The object (null if a static request is done)
The index.
If set to true, it's indexed with a name, if false it's indexed through brackets.
Performs an "index" "set" operation.
The script originating the request
The object (null if a static request is done)
The index.
The value to be set
If set to true, it's indexed with a name, if false it's indexed through brackets.
Converts this userdata to string
The object.
Gets a "meta" operation on this userdata. If a descriptor does not support this functionality,
it should return "null" (not a nil).
These standard metamethods can be supported (the return value should be a function accepting the
classic parameters of the corresponding metamethod):
__add, __sub, __mul, __div, __div, __pow, __unm, __eq, __lt, __le, __lt, __len, __concat,
__pairs, __ipairs, __iterator, __call
These standard metamethods are supported through other calls for efficiency:
__index, __newindex, __tostring
The script originating the request
The object (null if a static request is done)
The name of the metamember.
Determines whether the specified object is compatible with the specified type.
Unless a very specific behaviour is needed, the correct implementation is a
simple " return type.IsInstanceOfType(obj); "
The type.
The object.
Enumerations of the possible strategies to marshal CLR objects to MoonSharp userdata and functions
when using automatic descriptors.
Note that these are "hints" and MoonSharp is free to ignore the access mode specified (if different from
HideMembers) and downgrade the access mode to "Reflection".
This particularly happens when running on AOT platforms like iOS.
See also : and .
Optimization is not performed and reflection is used everytime to access members.
This is the slowest approach but saves a lot of memory if members are seldomly used.
Optimization is done on the fly the first time a member is accessed.
This saves memory for all members that are never accessed, at the cost of an increased script execution time.
Optimization is done at registration time.
Optimization is done in a background thread which starts at registration time.
If a member is accessed before optimization is completed, reflection is used.
Use the hardwired descriptor(s)
No optimization is done, and members are not accessible at all.
No reflection is allowed, nor code generation. This is used as a safeguard when registering types which should not
use a standard reflection based descriptor - for example for types implementing
Use the default access mode
Enumeration of the types of SymbolRef
The symbol ref of a local variable
The symbol ref of an upvalue variable
The symbol ref of a global variable
The symbol ref of the global environment
This class stores a possible l-value (that is a potential target of an assignment)
Gets the type of this symbol reference
Gets the index of this symbol in its scope context
Gets the name of this symbol
Gets the environment this symbol refers to (for global symbols only)
Gets the default _ENV.
Creates a new symbol reference pointing to a global var
The name.
The _ENV symbol.
Creates a new symbol reference pointing to a local var
The name.
The index of the var in local scope.
Creates a new symbol reference pointing to an upvalue var
The name.
The index of the var in closure scope.
Returns a that represents this instance.
A that represents this instance.
Writes this instance to a binary stream
Reads a symbolref from a binary stream
Enumeration of possible data types in MoonSharp
A nil value, as in Lua
A place holder for no value
A Lua boolean
A Lua number
A Lua string
A Lua function
A Lua table
A set of multiple values
A userdata reference - that is a wrapped CLR object
A coroutine handle
A callback function
A request to execute a tail call
A request to coroutine.yield
Extension methods to DataType
Determines whether this data type can have type metatables.
The type.
Converts the DataType to the string returned by the "type(...)" Lua function
The type.
The DataType is not a Lua type
Converts the DataType to the string returned by the "type(...)" Lua function, with additional values
to support debuggers
The type.
The DataType is not a Lua type
Converts the DataType to the string returned by the "type(...)" Lua function
The type.
The DataType is not a Lua type
A script loader loading scripts from an assembly resources
Initializes a new instance of the class.
The assembly containing the scripts as embedded resources or null to use the calling assembly.
Checks if a script file exists.
The script filename.
Opens a file for reading the script code.
It can return either a string, a byte[] or a Stream.
If a byte[] is returned, the content is assumed to be a serialized (dumped) bytecode. If it's a string, it's
assumed to be either a script or the output of a string.dump call. If a Stream, autodetection takes place.
The file.
The global context.
A string, a byte[] or a Stream.
A script loader loading scripts directly from the file system (does not go through platform object)
Checks if a script file exists.
The script filename.
Opens a file for reading the script code.
It can return either a string, a byte[] or a Stream.
If a byte[] is returned, the content is assumed to be a serialized (dumped) bytecode. If it's a string, it's
assumed to be either a script or the output of a string.dump call. If a Stream, autodetection takes place.
The file.
The global context.
A string, a byte[] or a Stream.
A script loader used for platforms we cannot initialize in any better way..
A base implementation of IScriptLoader, offering resolution of module names.
Checks if a script file exists.
The script filename.
Opens a file for reading the script code.
It can return either a string, a byte[] or a Stream.
If a byte[] is returned, the content is assumed to be a serialized (dumped) bytecode. If it's a string, it's
assumed to be either a script or the output of a string.dump call. If a Stream, autodetection takes place.
The file.
The global context.
A string, a byte[] or a Stream.
Resolves the name of a module on a set of paths.
The modname.
The paths.
Resolves the name of a module to a filename (which will later be passed to OpenScriptFile).
The resolution happens first on paths included in the LUA_PATH global variable (if and only if
the IgnoreLuaPathGlobal is false), and - if the variable does not exist - by consulting the
ScriptOptions.ModulesPaths array. Override to provide a different behaviour.
The modname.
The global context.
Gets or sets the modules paths used by the "require" function. If null, the default paths are used (using
environment variables etc.).
Unpacks a string path in a form like "?;?.lua" to an array
Gets the default environment paths.
Resolves a filename [applying paths, etc.]
The filename.
The global context.
Gets or sets a value indicating whether the LUA_PATH global is checked or not to get the path where modules are contained.
If true, the LUA_PATH global is NOT checked.
Class dictating how requests to read scripts from files are handled.
It's recommended that no class implement IScriptLoader directly, and rather extend ScriptLoaderBase.
Opens a file for reading the script code.
It can return either a string, a byte[] or a Stream.
If a byte[] is returned, the content is assumed to be a serialized (dumped) bytecode. If it's a string, it's
assumed to be either a script or the output of a string.dump call. If a Stream, autodetection takes place.
The file.
The global context.
A string, a byte[] or a Stream.
Resolves a filename [applying paths, etc.]
The filename.
The global context.
Resolves the name of a module to a filename (which will later be passed to OpenScriptFile)
The modname.
The global context.
A script loader which can load scripts from assets in Unity3D.
Scripts should be saved as .txt files in a subdirectory of Assets/Resources.
When MoonSharp is activated on Unity3D and the default script loader is used,
scripts should be saved as .txt files in Assets/Resources/MoonSharp/Scripts.
The default path where scripts are meant to be stored (if not changed)
Initializes a new instance of the class.
The path, relative to Assets/Resources. For example
if your scripts are stored under Assets/Resources/Scripts, you should
pass the value "Scripts". If null, "MoonSharp/Scripts" is used.
Initializes a new instance of the class.
A dictionary mapping filenames to the proper Lua script code.
Opens a file for reading the script code.
It can return either a string, a byte[] or a Stream.
If a byte[] is returned, the content is assumed to be a serialized (dumped) bytecode. If it's a string, it's
assumed to be either a script or the output of a string.dump call. If a Stream, autodetection takes place.
The file.
The global context.
A string, a byte[] or a Stream.
UnityAssetsScriptLoader.LoadFile : Cannot load + file
Checks if a given file exists
The file.
Gets the list of loaded scripts filenames (useful for debugging purposes).
Namespace containing classes used to customized how scripts are loaded from external files.
An implementation of which supports a very basic history of recent input lines.
Initializes a new instance of the class.
The script.
Size of the history.
Evaluate a REPL command.
This method returns the result of the computation, or null if more input is needed for having valid code.
In case of errors, exceptions are propagated to the caller.
The input.
This method returns the result of the computation, or null if more input is needed for a computation.
Gets the previous item in history, or null
Gets the next item in history, or null
A script loader loading scripts directly from the file system (does not go through platform object)
AND starts with module paths taken from environment variables (again, not going through the platform object).
The paths are preconstructed using :
* The MOONSHARP_PATH environment variable if it exists
* The LUA_PATH_5_2 environment variable if MOONSHARP_PATH does not exists
* The LUA_PATH environment variable if LUA_PATH_5_2 and MOONSHARP_PATH do not exists
* The "?;?.lua" path if all the above fail
Also, everytime a module is require(d), the "LUA_PATH" global variable is checked. If it exists, those paths
will be used to load the module instead of the global ones.
Initializes a new instance of the class.
Resolves the name of a module to a filename (which will later be passed to OpenScriptFile).
The resolution happens first on paths included in the LUA_PATH global variable, and -
if the variable does not exist - by consulting the
ScriptOptions.ModulesPaths array. Override to provide a different behaviour.
The modname.
The global context.
Contains classes useful to implement REPL interpreters.
See :
This class provides a simple REPL intepreter ready to be reused in a simple way.
Initializes a new instance of the class.
The script.
Gets or sets a value indicating whether this instances handle inputs starting with a "?" as a
dynamic expression to evaluate instead of script code (likely invalid)
Gets or sets a value indicating whether this instances handle inputs starting with a "=" as a
non-dynamic expression to evaluate (just like the Lua interpreter does by default).
Gets a value indicating whether this instance has a pending command
Gets the current pending command.
Gets the classic prompt (">" or ">>") given the current state of the interpreter
Evaluate a REPL command.
This method returns the result of the computation, or null if more input is needed for having valid code.
In case of errors, exceptions are propagated to the caller.
The input.
This method returns the result of the computation, or null if more input is needed for a computation.
In a module type, mark fields with this attribute to have them exposed as a module constant.
See for more information about modules.
Gets or sets the name of the constant - if different from the name of the field itself
Namespace containing all the most commonly used classes for MoonSharp operation.
When in doubt, refer to and classes as starting points.
Namespace containing classes used to customize how the interfacing with the operative system happens
for the 'os' and 'io' modules, and for future modules/classes which may require OS access.
See and .
Interface to abstract all accesses made to the underlying platform (OS, framework) by the scripting engine.
Can be used both to support "non-standard" platforms (i.e. non-posix, non-windows) and/or to sandbox the behaviour
of the scripting engine.
It's recommended that no class implement IPlatformAccessor directly, and rather extend .
Filters the CoreModules enumeration to exclude non-supported operations
The requested modules.
The requested modules, with unsupported modules filtered out.
Gets an environment variable. Must be implemented, but an implementation is allowed
to always return null if a more meaningful implementation cannot be achieved or is
not desired.
The envvarname.
The environment variable value, or null if not found
Determines whether the application is running in AOT (ahead-of-time) mode
Gets the name of the platform (used for debug purposes).
The name of the platform (used for debug purposes)
Default handler for 'print' calls. Can be customized in ScriptOptions
The content.
Default handler for interactive line input calls. Can be customized in ScriptOptions.
If a meaningful implementation cannot be provided, this method should return null.
A function used to open files in the 'io' module.
Can have an invalid implementation if 'io' module is filtered out.
It should return a correctly initialized Stream for the given file and access
The script.
The filename.
The encoding.
The mode (as per Lua usage - e.g. 'w+', 'rb', etc.).
Gets a standard stream (stdin, stdout, stderr).
The type.
Gets a temporary filename. Used in 'io' and 'os' modules.
Can have an invalid implementation if 'io' and 'os' modules are filtered out.
Exits the process, returning the specified exit code.
Can have an invalid implementation if the 'os' module is filtered out.
The exit code.
Checks if a file exists. Used by the 'os' module.
Can have an invalid implementation if the 'os' module is filtered out.
The file.
True if the file exists, false otherwise.
Deletes the specified file. Used by the 'os' module.
Can have an invalid implementation if the 'os' module is filtered out.
The file.
Moves the specified file. Used by the 'os' module.
Can have an invalid implementation if the 'os' module is filtered out.
The source.
The DST.
Executes the specified command line, returning the child process exit code and blocking in the meantime.
Can have an invalid implementation if the 'os' module is filtered out.
The cmdline.
An abstract class which offers basic services on top of IPlatformAccessor to provide easier implementation of platforms.
Gets the platform name prefix
Gets the name of the platform (used for debug purposes).
The name of the platform (used for debug purposes)
Default handler for 'print' calls. Can be customized in ScriptOptions
The content.
DEPRECATED.
This is kept for backward compatibility, see the overload taking a prompt as an input parameter.
Default handler for interactive line input calls. Can be customized in ScriptOptions.
If an inheriting class whants to give a meaningful implementation, this method MUST be overridden.
null
Default handler for interactive line input calls. Can be customized in ScriptOptions.
If an inheriting class whants to give a meaningful implementation, this method MUST be overridden.
null
A function used to open files in the 'io' module.
Can have an invalid implementation if 'io' module is filtered out.
It should return a correctly initialized Stream for the given file and access
The filename.
The encoding.
The mode (as per Lua usage - e.g. 'w+', 'rb', etc.).
Gets a standard stream (stdin, stdout, stderr).
The type.
Gets a temporary filename. Used in 'io' and 'os' modules.
Can have an invalid implementation if 'io' and 'os' modules are filtered out.
Exits the process, returning the specified exit code.
Can have an invalid implementation if the 'os' module is filtered out.
The exit code.
Checks if a file exists. Used by the 'os' module.
Can have an invalid implementation if the 'os' module is filtered out.
The file.
True if the file exists, false otherwise.
Deletes the specified file. Used by the 'os' module.
Can have an invalid implementation if the 'os' module is filtered out.
The file.
Moves the specified file. Used by the 'os' module.
Can have an invalid implementation if the 'os' module is filtered out.
The source.
The DST.
Executes the specified command line, returning the child process exit code and blocking in the meantime.
Can have an invalid implementation if the 'os' module is filtered out.
The cmdline.
Filters the CoreModules enumeration to exclude non-supported operations
The requested modules.
The requested modules, with unsupported modules filtered out.
Gets an environment variable. Must be implemented, but an implementation is allowed
to always return null if a more meaningful implementation cannot be achieved or is
not desired.
The envvarname.
The environment variable value, or null if not found
Determines whether the application is running in AOT (ahead-of-time) mode
A static class offering properties for autodetection of system/platform details
Gets a value indicating whether this instance is running on mono.
Gets a value indicating whether this instance is running on a CLR4 compatible implementation
Gets a value indicating whether this instance is running on Unity-3D
Gets a value indicating whether this instance has been built as a Portable Class Library
Gets a value indicating whether this instance is running a system using Ahead-Of-Time compilation
and not supporting JIT.
A class implementing all the bits needed to have a minimal support of a platform.
This does not support the 'io'/'file' modules and has partial support of the 'os' module.
Gets an environment variable. Must be implemented, but an implementation is allowed
to always return null if a more meaningful implementation cannot be achieved or is
not desired.
The envvarname.
The environment variable value, or null if not found
Filters the CoreModules enumeration to exclude non-supported operations
The requested modules.
The requested modules, with unsupported modules filtered out.
A function used to open files in the 'io' module.
LimitedPlatformAccessorBase does NOT offer a meaningful implementation of this method and
thus does not support 'io' and 'os' modules.
The filename.
The encoding.
The mode (as per Lua usage - e.g. 'w+', 'rb', etc.).
The current platform accessor does not support 'io' and 'os' operations. Provide your own implementation of platform to work around this limitation, if needed.
Gets a standard stream (stdin, stdout, stderr).
LimitedPlatformAccessorBase does NOT offer a meaningful implementation of this method and
thus does not support 'io' and 'os' modules.
The type.
The current platform accessor does not support 'io' and 'os' operations. Provide your own implementation of platform to work around this limitation, if needed.
Gets a temporary filename. Used in 'io' and 'os' modules.
LimitedPlatformAccessorBase does NOT offer a meaningful implementation of this method and
thus does not support 'io' and 'os' modules.
The current platform accessor does not support 'io' and 'os' operations. Provide your own implementation of platform to work around this limitation, if needed.
Exits the process, returning the specified exit code.
LimitedPlatformAccessorBase does NOT offer a meaningful implementation of this method and
thus does not support 'io' and 'os' modules.
The exit code.
The current platform accessor does not support 'io' and 'os' operations. Provide your own implementation of platform to work around this limitation, if needed.
Checks if a file exists. Used by the 'os' module.
LimitedPlatformAccessorBase does NOT offer a meaningful implementation of this method and
thus does not support 'io' and 'os' modules.
The file.
True if the file exists, false otherwise.
The current platform accessor does not support 'io' and 'os' operations. Provide your own implementation of platform to work around this limitation, if needed.
Deletes the specified file. Used by the 'os' module.
LimitedPlatformAccessorBase does NOT offer a meaningful implementation of this method and
thus does not support 'io' and 'os' modules.
The file.
The current platform accessor does not support 'io' and 'os' operations. Provide your own implementation of platform to work around this limitation, if needed.
Moves the specified file. Used by the 'os' module.
LimitedPlatformAccessorBase does NOT offer a meaningful implementation of this method and
thus does not support 'io' and 'os' modules.
The source.
The DST.
The current platform accessor does not support 'io' and 'os' operations. Provide your own implementation of platform to work around this limitation, if needed.
Executes the specified command line, returning the child process exit code and blocking in the meantime.
LimitedPlatformAccessorBase does NOT offer a meaningful implementation of this method and
thus does not support 'io' and 'os' modules.
The cmdline.
The current platform accessor does not support 'io' and 'os' operations. Provide your own implementation of platform to work around this limitation, if needed.
Gets the platform name prefix
Default handler for 'print' calls. Can be customized in ScriptOptions
The content.
Enumeration of standard file handles
Standard Input
Standard Output
Standard Error Output
Class providing the IPlatformAccessor interface for standard full-feaured implementations.
Converts a Lua string access mode to a FileAccess enum
The mode.
Converts a Lua string access mode to a ParseFileMode enum
The mode.
A function used to open files in the 'io' module.
Can have an invalid implementation if 'io' module is filtered out.
It should return a correctly initialized Stream for the given file and access
The filename.
The encoding.
The mode (as per Lua usage - e.g. 'w+', 'rb', etc.).
Gets an environment variable. Must be implemented, but an implementation is allowed
to always return null if a more meaningful implementation cannot be achieved or is
not desired.
The envvarname.
The environment variable value, or null if not found
Gets a standard stream (stdin, stdout, stderr).
The type.
type
Default handler for 'print' calls. Can be customized in ScriptOptions
The content.
Gets a temporary filename. Used in 'io' and 'os' modules.
Can have an invalid implementation if 'io' and 'os' modules are filtered out.
Exits the process, returning the specified exit code.
Can have an invalid implementation if the 'os' module is filtered out.
The exit code.
Checks if a file exists. Used by the 'os' module.
Can have an invalid implementation if the 'os' module is filtered out.
The file.
True if the file exists, false otherwise.
Deletes the specified file. Used by the 'os' module.
Can have an invalid implementation if the 'os' module is filtered out.
The file.
Moves the specified file. Used by the 'os' module.
Can have an invalid implementation if the 'os' module is filtered out.
The source.
The DST.
Executes the specified command line, returning the child process exit code and blocking in the meantime.
Can have an invalid implementation if the 'os' module is filtered out.
The cmdline.
Filters the CoreModules enumeration to exclude non-supported operations
The requested modules.
The requested modules, with unsupported modules filtered out.
Gets the platform name prefix
This class implements a MoonSharp scripting session. Multiple Script objects can coexist in the same program but cannot share
data among themselves unless some mechanism is put in place.
The version of the MoonSharp engine
The Lua version being supported
Initializes the class.
Initializes a new instance of the clas.s
Initializes a new instance of the class.
The core modules to be pre-registered in the default global table.
Gets or sets the script loader which will be used as the value of the
ScriptLoader property for all newly created scripts.
Gets access to the script options.
Gets the global options, that is options which cannot be customized per-script.
Gets access to performance statistics.
Gets the default global table for this script. Unless a different table is intentionally passed (or setfenv has been used)
execution uses this table.
Loads a string containing a Lua/MoonSharp function.
The code.
The global table to bind to this chunk.
Name of the function used to report errors, etc.
A DynValue containing a function which will execute the loaded code.
Loads a string containing a Lua/MoonSharp script.
The code.
The global table to bind to this chunk.
Name of the code - used to report errors, etc.
A DynValue containing a function which will execute the loaded code.
Loads a Lua/MoonSharp script from a System.IO.Stream. NOTE: This will *NOT* close the stream!
The stream containing code.
The global table to bind to this chunk.
Name of the code - used to report errors, etc.
A DynValue containing a function which will execute the loaded code.
Dumps on the specified stream.
The function.
The stream.
function arg is not a function!
or
stream is readonly!
or
function arg has upvalues other than _ENV
Loads a string containing a Lua/MoonSharp script.
The code.
The global table to bind to this chunk.
The filename to be used in error messages.
A DynValue containing a function which will execute the loaded code.
Loads and executes a string containing a Lua/MoonSharp script.
The code.
The global context.
A DynValue containing the result of the processing of the loaded chunk.
Loads and executes a stream containing a Lua/MoonSharp script.
The stream.
The global context.
A DynValue containing the result of the processing of the loaded chunk.
Loads and executes a file containing a Lua/MoonSharp script.
The filename.
The global context.
A DynValue containing the result of the processing of the loaded chunk.
Runs the specified file with all possible defaults for quick experimenting.
The filename.
A DynValue containing the result of the processing of the executed script.
Runs the specified code with all possible defaults for quick experimenting.
The Lua/MoonSharp code.
A DynValue containing the result of the processing of the executed script.
Creates a closure from a bytecode address.
The address.
The env table to create a 0-upvalue
Calls the specified function.
The Lua/MoonSharp function to be called
The return value(s) of the function call.
Thrown if function is not of DataType.Function
Calls the specified function.
The Lua/MoonSharp function to be called
The arguments to pass to the function.
The return value(s) of the function call.
Thrown if function is not of DataType.Function
Calls the specified function.
The Lua/MoonSharp function to be called
The arguments to pass to the function.
The return value(s) of the function call.
Thrown if function is not of DataType.Function
Calls the specified function.
The Lua/MoonSharp function to be called
Thrown if function is not of DataType.Function
Calls the specified function.
The Lua/MoonSharp function to be called
The arguments to pass to the function.
Thrown if function is not of DataType.Function
Creates a coroutine pointing at the specified function.
The function.
The coroutine handle.
Thrown if function is not of DataType.Function or DataType.ClrFunction
Creates a coroutine pointing at the specified function.
The function.
The coroutine handle.
Thrown if function is not of DataType.Function or DataType.ClrFunction
Gets the main chunk function.
A DynValue containing a function which executes the first chunk that has been loaded.
Gets or sets a value indicating whether the debugger is enabled.
Note that unless a debugger attached, this property returns a
value which might not reflect the real status of the debugger.
Use this property if you want to disable the debugger for some
executions.
Attaches a debugger. This usually should be called by the debugger itself and not by user code.
The debugger object.
Gets the source code.
The source code identifier.
Gets the source code count.
The source code count.
Loads a module as per the "require" Lua function. http://www.lua.org/pil/8.1.html
The module name
The global context.
Raised if module is not found
Gets a type metatable.
The type.
Sets a type metatable.
The type. Must be Nil, Boolean, Number, String or Function
The metatable.
Specified type not supported : + type.ToString()
Warms up the parser/lexer structures so that MoonSharp operations start faster.
Creates a new dynamic expression.
The code of the expression.
Creates a new dynamic expression which is actually quite static, returning always the same constant value.
The code of the not-so-dynamic expression.
The constant to return.
Gets an execution context exposing only partial functionality, which should be used for
those cases where the execution engine is not really running - for example for dynamic expression
or calls from CLR to CLR callbacks
MoonSharp (like Lua itself) provides a registry, a predefined table that can be used by any CLR code to
store whatever Lua values it needs to store.
Any CLR code can store data into this table, but it should take care to choose keys
that are different from those used by other libraries, to avoid collisions.
Typically, you should use as key a string GUID, a string containing your library name, or a
userdata with the address of a CLR object in your code.
A class representing a Lua table.
Initializes a new instance of the class.
The owner script.
Initializes a new instance of the class.
The owner.
The values for the "array-like" part of the table.
Gets the script owning this resource.
Removes all items from the Table.
Gets the integral key from a double.
Gets or sets the
with the specified key(s).
This will marshall CLR and MoonSharp objects in the best possible way.
Multiple keys can be used to access subtables.
The .
The key.
Optional subkeys to access subtables
Gets or sets the with the specified key(s).
This will marshall CLR and MoonSharp objects in the best possible way.
The .
The key.
Gets the dynvalue associated with the specified key (expressed as a System.Object)
The key.
Gets the dynvalue associated with the specified key (expressed as a System.Object) as a System.Object.
The key.
Sets the dynvalue associated with the specified key. Both expressed as System.Object.
The key.
The value.
Sets the value associated to the specified key.
The key.
The value.
Gets the value associated with the specified key.
The key.
Sets the value associated to the specified key.
The key.
The value.
Gets the value associated with the specified key.
The key.
Gets the value associated with the specified key, without bringing to Nil the non-existant values.
The key.
Sets the value associated to the specified key.
The key.
The value.
Gets the value associated with the specified key.
The key.
Collects the dead keys. This frees up memory but invalidates pending iterators.
It's called automatically internally when the semantics of Lua tables allow, but can be forced
externally if it's known that no iterators are pending.
Returns the next pair from a value
Gets the length of the "array part".
Gets the meta-table associated with this instance.
Enumerates the key/value pairs.
Enumerates the keys.
Enumerates the values
Enumeration (combinable as flags) of all the standard library modules
Value used to specify no modules to be loaded (equals 0).
The basic methods. Includes "assert", "collectgarbage", "error", "print", "select", "type", "tonumber" and "tostring".
The global constants: "_G", "_VERSION" and "_MOONSHARP".
The table iterators: "next", "ipairs" and "pairs".
The metatable methods : "setmetatable", "getmetatable", "rawset", "rawget", "rawequal" and "rawlen".
The string package
The load methods: "load", "loadsafe", "loadfile", "loadfilesafe", "dofile" and "require"
The table package
The error handling methods: "pcall" and "xpcall"
The math package
The coroutine package
The bit32 package
The time methods of the "os" package: "clock", "difftime", "date" and "time"
The methods of "os" package excluding those listed for OS_Time. These are not supported under Unity.
The methods of "io" and "file" packages. These are not supported under Unity.
The "debug" package (it has limited support)
The "dynamic" package (introduced by MoonSharp).
A sort of "hard" sandbox preset, including string, math, table, bit32 packages, constants and table iterators.
A softer sandbox preset, adding metatables support, error handling, coroutine, time functions and dynamic evaluations.
The default preset. Includes everything except "debug" as now.
Beware that using this preset allows scripts unlimited access to the system.
The complete package.
Beware that using this preset allows scripts unlimited access to the system.
Class managing modules (mostly as extension methods)
Register the core modules to a table
The table.
The modules.
Registers the standard constants (_G, _VERSION, _MOONSHARP) to a table
The table.
Registers a module type to the specified table
The table.
The type
If the module contains some incompatibility
Registers a module type to the specified table
The module type
The table.
If the module contains some incompatibility
In a module type, mark methods or fields with this attribute to have them exposed as module functions.
Methods must have the signature "public static DynValue ...(ScriptExecutionContextCallbackArguments)".
Fields must be static or const strings, with an anonymous Lua function inside.
See for more information about modules.
Gets or sets the name of the function in the module (defaults to member name)
Marks a CLR type to be a MoonSharp module.
Modules are the fastest way to bring interop between scripts and CLR code, albeit at the cost of a very increased
complexity in writing them. Modules is what's used for the standard library, for maximum efficiency.
Modules are basically classes containing only static methods, with the callback function signature.
See and for (extension) methods used to register modules to a
table.
See for information regarding the standard callback signature along with easier ways
to marshal methods.
See for easier object marshalling.
Gets or sets the namespace, that is the name of the table which will contain the defined functions.
Can be null to be in the global table.
Class containing script global options, that is options which cannot be customized per-script.
Gets or sets the custom converters.
Gets or sets the platform abstraction to use.
The current platform abstraction.
This class contains options to customize behaviour of Script objects.
Gets or sets the current script-loader.
Gets or sets the debug print handler
Gets or sets the debug input handler (takes a prompt as an input, for interactive interpreters, like debug.debug).
Gets or sets a value indicating whether error messages will use Lua error locations instead of MoonSharp
improved ones. Use this for compatibility with legacy Lua code which parses error messages.
Gets or sets the stream used as stdin. If null, a default stream is used.
Gets or sets the stream used as stdout. If null, a default stream is used.
Gets or sets the stream used as stderr. If null, a default stream is used.
Gets or sets the stack depth threshold at which MoonSharp starts doing
tail call optimizations.
TCOs can provide the little benefit of avoiding stack overflows in corner case
scenarios, at the expense of losing debug information and error stack traces
in all other, more common scenarios. MoonSharp choice is to start performing
TCOs only after a certain threshold of stack usage is reached - by default
half the current stack depth (128K entries), thus 64K entries, on either
the internal stacks.
Set this to int.MaxValue to disable TCOs entirely, or to 0 to always have
TCOs enabled.
Gets or sets a value indicating whether the thread check is enabled.
A "lazy" thread check is performed everytime execution is entered to ensure that no two threads
calls MoonSharp execution concurrently. However 1) the check is performed best effort (thus, it might
not detect all issues) and 2) it might trigger in very odd legal situations (like, switching threads
inside a CLR-callback without actually having concurrency.
Disable this option if the thread check is giving problems in your scenario, but please check that
you are not calling MoonSharp execution concurrently as it is not supported.
Creates a sub tree of binary expressions
Primaries the exp.
The lcontext.