Updated for Lua 5.2 and ModularLua changes.