mjolnir._asm.compat_51

Home: https://github.com/asmagill/mjolnir_asm.compat_51

The Lua 5.2 engine included with Mjolnir does not include the Lua 5.1 deprecated functions in it's build. I actually agree with this because new code should be written to a current standard and updates should be encouraged.

However, this is not always possible, and many modules exist which almost work under Lua 5.2, but just need a few supporting functions to continue to be viable.

Here I have attempted to replicate the compatibility functions within the Lua 5.2.3 source code as a separate module so that they can be added as needed, and removed when not. This code is almost entirely from the Lua 5.2.3 source (http://www.lua.org/download.html) and is just packaged for convenience.

The following Lua 5.1 functions and variables are "created" when the enable function is invoked:

See (http://www.lua.org/manual/5.2/manual.html#8) for more details.

disable

mjolnir._asm.compat_51.disable()

Disable Lua 5.1 Compatibility features by removing them from the global namespace.

enable

mjolnir._asm.compat_51.enable()

Enable Lua 5.1 Compatibility features by adding the appropriate functions into the expected globals.

pcall

mjolnir._asm.compat_51.pcall(f, ...) -> bool [,...]

Similar to pcall, but with Lua 5.1 compatibility functions enabled for the call only.

status

mjolnir._asm.compat_51.status

Boolean variable indicating whether or not Lua 5.1 compatibility functions are enabled or not.