CoreModules.Basic) provides essential Lua functions that form the foundation of any Lua script.
Functions
print(…)
Prints values to the configured output stream (by default, the debug output).tostring() metamethod if available.
Output:
type(v)
Returns the type of a value as a string."nil", "number", "string", "boolean", "table", "function", "thread", or "userdata"
tostring(v)
Converts a value to a string.__tostring metamethod:
tonumber(e [, base])
Converts a value to a number.e- Value to convert (number or string)base- Optional base (2-36 for integer conversion)
nil if conversion fails
Note: SolarSharp supports bases 2-36, with enhanced support for bases 2-10.
assert(v [, message])
Raises an error if the condition is false.error(message [, level])
Terminates execution and raises an error.message- Error message stringlevel- Stack level for error reporting:1(default): Error location is whereerrorwas called2: Error location is the caller of the function that callederror0: No location information added
select(index, …)
Returns selected arguments from a list.index- Either:"#"- Returns the count of remaining arguments- Number - Returns all arguments starting from that position
collectgarbage([opt [, arg]])
Interface to the .NET garbage collector.nil, "collect", and "restart" trigger a collection. Other Lua GC options are not supported.
C# Integration
All basic functions are implemented in theBasicModule class: