This page tracks which parts of the Lua 5.2 standard library MoonSharp implements, on which platforms, and which functions can yield.
NOTE : this reflects the state of the standard library as captured in the original status document. It has not been re-verified against the 3.0.0 beta - see the changelog for recent changes.
| New in Moon# | Function has been introduced in Moon# and is not present in Lua 5.2 |
| Done | Implemented completely |
| Done, with differences | Implemented, but has differences from the Lua version (detailed in comments) |
| Not done, issues | Not completed yet |
| Unsupported, stub | Unsupported, but implemented as a stub for compatibility |
| Unsupported | Unsupported and likely support will be limited or non-existent also in the future |
| Not done yet | Not even started |
The Yield column says whether the function can yield a coroutine: YES it can, NO it cannot, – not applicable.
| API | Status | Yield | CLR | Mono | Unity | Differences | Yielding notes |
|---|---|---|---|---|---|---|---|
_G | Done | – | ✓ | ✓ | ✓ | ||
_VERSION | Done | – | ✓ | ✓ | ✓ | ||
_MOONSHARP | New in Moon# | – | ✓ | ✓ | ✓ | A table, containing several fields including moonsharp version, platform and emulated lua version. | |
assert | Done | – | ✓ | ✓ | ✓ | ||
collectgarbage | Done | – | ✓ | ✓ | ✓ | Some arguments ignored | |
dofile | Done | YES | ✓ | ✓ | ✓ | ||
error | Done | – | ✓ | ✓ | ✓ | ||
getmetatable | Done | – | ✓ | ✓ | ✓ | ||
ipairs | Done | YES | ✓ | ✓ | ✓ | ||
load | Done | NO | ✓ | ✓ | ✓ | A function as input cannot yield. | |
loadsafe | New in Moon# | NO | ✓ | ✓ | ✓ | Same as loadfile, but with better handling of default _ENV for sandboxing. | |
loadfile | Done, with differences | – | ✓ | ✓ | ✓ | stdin as input is not supported. | |
loadfilesafe | New in Moon# | – | ✓ | ✓ | ✓ | Same as loadfile, but with better handling of default _ENV for sandboxing. | |
next | Done | – | ✓ | ✓ | ✓ | ||
pairs | Done | YES | ✓ | ✓ | ✓ | ||
pcall | Done | YES | ✓ | ✓ | ✓ | ||
print | Done | NO | ✓ | ✓ | ✓ | __tostring cannot yield when called from print | |
rawequal | Done | – | ✓ | ✓ | ✓ | ||
rawget | Done | – | ✓ | ✓ | ✓ | ||
rawlen | Done | – | ✓ | ✓ | ✓ | ||
rawset | Done | – | ✓ | ✓ | ✓ | ||
require | Done | YES | ✓ | ✓ | ✓ | Minor internal differences | |
select | Done | – | ✓ | ✓ | ✓ | ||
setmetatable | Done | – | ✓ | ✓ | ✓ | ||
tonumber | Done, with differences | – | ✓ | ✓ | ✓ | Only bases between 2 and 10, and base 16 are supported. | |
tostring | Done | YES | ✓ | ✓ | ✓ | ||
type | Done | – | ✓ | ✓ | ✓ | ||
xpcall | Done, with differences | NO | ✓ | ✓ | ✓ | Double faults are appended to error and ignored. | Code can yield, but the error message handler cannot. |
bit32.arshift | Done | ✓ | ✓ | ✓ | |||
bit32.band | Done | ✓ | ✓ | ✓ | |||
bit32.bnot | Done | ✓ | ✓ | ✓ | |||
bit32.bor | Done | ✓ | ✓ | ✓ | |||
bit32.btest | Done | ✓ | ✓ | ✓ | |||
bit32.bxor | Done | ✓ | ✓ | ✓ | |||
bit32.extract | Done | ✓ | ✓ | ✓ | |||
bit32.lrotate | Done | ✓ | ✓ | ✓ | |||
bit32.lshift | Done | ✓ | ✓ | ✓ | |||
bit32.replace | Done | ✓ | ✓ | ✓ | |||
bit32.rrotate | Done | ✓ | ✓ | ✓ | |||
bit32.rshift | Done | ✓ | ✓ | ✓ | |||
coroutine.create | Done | ✓ | ✓ | ✓ | |||
coroutine.resume | Done | ✓ | ✓ | ✓ | |||
coroutine.running | Done | ✓ | ✓ | ✓ | |||
coroutine.status | Done | ✓ | ✓ | ✓ | |||
coroutine.wrap | Done | ✓ | ✓ | ✓ | |||
coroutine.yield | Done | ✓ | ✓ | ✓ | |||
debug.debug | Done | ✓ | ✓ | ✓ | |||
debug.getuservalue | Done | ✓ | ✓ | ✓ | |||
debug.gethook | Unsupported | ✗ | ✗ | ✗ | Use the debugger infrastructure. | ||
debug.getinfo | Unsupported | ✗ | ✗ | ✗ | Function is heavily dependent on implementation details. | ||
debug.getlocal | Unsupported | ✗ | ✗ | ✗ | Function is heavily dependent on implementation details. | ||
debug.getmetatable | Done | ✓ | ✓ | ✓ | |||
debug.getregistry | Done | ✓ | ✓ | ✓ | |||
debug.getupvalue | Done | ✓ | ✓ | ✓ | |||
debug.setuservalue | Done | ✓ | ✓ | ✓ | |||
debug.sethook | Unsupported | ✗ | ✗ | ✗ | Use the debugger infrastructure. | ||
debug.setlocal | Unsupported | ✗ | ✗ | ✗ | Function is heavily dependent on implementation details. | ||
debug.setmetatable | Done | ✓ | ✓ | ✓ | Cannot set on userdata as now. | ||
debug.setupvalue | Done | ✓ | ✓ | ✓ | |||
debug.traceback | Done | ✓ | ✓ | ✓ | |||
debug.upvalueid | Done, with differences | ✓ | ✓ | ✓ | Works ok, but returns a number instead of userdata (still, can be used in pretty much the same way). | ||
debug.upvaluejoin | Not done yet | ||||||
dynamic.eval | New in Moon# | ✓ | ✓ | ✓ | Evaluates the code passed as a parameter dynamically. All accesses are raw, function calls will raise an error. | ||
dynamic.prepare | New in Moon# | ✓ | ✓ | ✓ | Prepares an expression for faster evaluation with dynamic.eval. | ||
file:close | Done | ✓ | ✓ | ✗ | |||
file:flush | Done | ✓ | ✓ | ✗ | |||
file:lines | Done | ✓ | ✓ | ✗ | |||
file:read | Done | ✓ | ✓ | ✗ | |||
file:seek | Done | ✓ | ✓ | ✗ | |||
file:setvbuf | Done | ✓ | ✓ | ✗ | |||
file:write | Done | ✓ | ✓ | ✗ | |||
io.close | Done | ✓ | ✓ | ✗ | |||
io.flush | Done | ✓ | ✓ | ✗ | |||
io.input | Done | ✓ | ✓ | ✗ | |||
io.lines | Done | ✓ | ✓ | ✗ | |||
io.open | Done | ✓ | ✓ | ✗ | |||
io.output | Done | ✓ | ✓ | ✗ | |||
io.popen | Unsupported | ✓ | ✓ | ✗ | Interprocess comms, stdin and stdout are NOT supported. This however is ok by the Lua standard. | ||
io.read | Done | ✓ | ✓ | ✗ | |||
io.stderr | Done | ✓ | ✓ | ✗ | |||
io.stdin | Done | ✓ | ✓ | ✗ | |||
io.stdout | Done | ✓ | ✓ | ✗ | |||
io.tmpfile | Done | ✓ | ✓ | ✗ | |||
io.type | Done | ✓ | ✓ | ✗ | |||
io.write | Done | ✓ | ✓ | ✗ | |||
math.abs | Done | – | ✓ | ✓ | ✓ | ||
math.acos | Done | – | ✓ | ✓ | ✓ | ||
math.asin | Done | – | ✓ | ✓ | ✓ | ||
math.atan | Done | – | ✓ | ✓ | ✓ | ||
math.atan2 | Done | – | ✓ | ✓ | ✓ | ||
math.ceil | Done | – | ✓ | ✓ | ✓ | ||
math.cos | Done | – | ✓ | ✓ | ✓ | ||
math.cosh | Done | – | ✓ | ✓ | ✓ | ||
math.deg | Done | – | ✓ | ✓ | ✓ | ||
math.exp | Done | – | ✓ | ✓ | ✓ | ||
math.floor | Done | – | ✓ | ✓ | ✓ | ||
math.fmod | Done | – | ✓ | ✓ | ✓ | ||
math.frexp | Done | – | ✓ | ✓ | ✓ | ||
math.huge | Done | – | ✓ | ✓ | ✓ | ||
math.ldexp | Done | – | ✓ | ✓ | ✓ | ||
math.log | Done | – | ✓ | ✓ | ✓ | ||
math.max | Done | – | ✓ | ✓ | ✓ | ||
math.min | Done | – | ✓ | ✓ | ✓ | ||
math.modf | Done | – | ✓ | ✓ | ✓ | ||
math.pi | Done | – | ✓ | ✓ | ✓ | ||
math.pow | Done | – | ✓ | ✓ | ✓ | ||
math.rad | Done | – | ✓ | ✓ | ✓ | ||
math.random | Done | – | ✓ | ✓ | ✓ | Minor differences in accepted inputs (MoonSharp is more tolerant) | |
math.randomseed | Done | – | ✓ | ✓ | ✓ | ||
math.sin | Done | – | ✓ | ✓ | ✓ | ||
math.sinh | Done | – | ✓ | ✓ | ✓ | ||
math.sqrt | Done | – | ✓ | ✓ | ✓ | ||
math.tan | Done | – | ✓ | ✓ | ✓ | ||
math.tanh | Done | – | ✓ | ✓ | ✓ | ||
os.clock | Done | ✓ | ✓ | ✓ | |||
os.date | Done | ✓ | ✓ | ✓ | Running on Mono systems might lead to erroneous output due to a Mono bug (11817) | ||
os.difftime | Done | ✓ | ✓ | ✓ | |||
os.execute | Done | ✓ | ✓ | ✗ | |||
os.exit | Done | ✓ | ✓ | ✗ | |||
os.getenv | Done | ✓ | ✓ | ✗ | |||
os.remove | Done | ✓ | ✓ | ✗ | |||
os.rename | Done | ✓ | ✓ | ✗ | |||
os.setlocale | Unsupported, stub | ✓ | ✓ | ✗ | Unsupported, currently a stub | ||
os.time | Done | ✓ | ✓ | ✓ | |||
os.tmpname | Done | ✓ | ✓ | ✗ | |||
package.config | Done | ✓ | ✓ | ✓ | |||
package.cpath | Unsupported | ✗ | ✗ | ✗ | See Script loaders to see how to customize loading of scripts and packages | ||
package.loaded | Done | ✓ | ✓ | ✓ | |||
package.loadlib | Unsupported | ✗ | ✗ | ✗ | See Script loaders to see how to customize loading of scripts and packages | ||
package.path | Unsupported | ✗ | ✗ | ✗ | See Script loaders to see how to customize loading of scripts and packages | ||
package.preload | Unsupported | ✗ | ✗ | ✗ | See Script loaders to see how to customize loading of scripts and packages | ||
package.searchers | Unsupported | ✗ | ✗ | ✗ | See Script loaders to see how to customize loading of scripts and packages | ||
package.searchpath | Unsupported | ✗ | ✗ | ✗ | See Script loaders to see how to customize loading of scripts and packages | ||
string.byte | Done | ✓ | ✓ | ✓ | Character codes are cropped to 0-255. Use string.unicode to have the unicode code-point. | ||
string.char | Done | ✓ | ✓ | ✓ | Values > 255 are silently supported (as unicode codepoints) | ||
string.dump | Done | ✓ | ✓ | ✓ | Functions with upvalues raise an error as Lua 5.0 did and as Lua 5.2 should do according to documentation. | ||
string.find | Done | ✓ | ✓ | ✓ | Implementation taken from KopiLua. Patterns cannot contain \0. Use %z instead. | ||
string.format | Done | NO | ✓ | ✓ | ✓ | Implementation taken from KopiLua. | __tostring metamethod cannot yield. |
string.gmatch | Done | ✓ | ✓ | ✓ | Implementation taken from KopiLua. Patterns cannot contain \0. Use %z instead. | ||
string.gsub | Done | NO | ✓ | ✓ | ✓ | Implementation taken from KopiLua. Patterns cannot contain \0. Use %z instead. | Callback function (if used) cannot yield. |
string.len | Done | ✓ | ✓ | ✓ | |||
string.lower | Done | ✓ | ✓ | ✓ | |||
string.match | Done | ✓ | ✓ | ✓ | Implementation taken from KopiLua. Patterns cannot contain \0. Use %z instead. | ||
string.rep | Done | ✓ | ✓ | ✓ | |||
string.reverse | Done | ✓ | ✓ | ✓ | |||
string.sub | Done | ✓ | ✓ | ✓ | |||
string.unicode | New in Moon# | ✓ | ✓ | ✓ | Works just as string.byte would do, but returns the unicode code-point without truncation. | ||
string.upper | Done | ✓ | ✓ | ✓ | |||
table.concat | Done | NO | ✓ | ✓ | ✓ | __len cannot yield | |
table.insert | Done | NO | ✓ | ✓ | ✓ | __len cannot yield | |
table.pack | Done | ✓ | ✓ | ✓ | |||
table.remove | Done | NO | ✓ | ✓ | ✓ | __len cannot yield | |
table.sort | Done | NO | ✓ | ✓ | ✓ | __lt, __len and the comparison function cannot yield | |
table.unpack | Done | ✓ | ✓ | ✓ |
The original spreadsheet is still available as a PDF download.