ComputerCraft

ComputerCraft

21M Downloads

Useless "mode" argument in load

JasonTheKitten opened this issue ยท 1 comments

commented

function load( x, name, mode, env )

The "load" function takes a mode argument which doesn't do much. Most programs don't use binary loading, so they will not care about the thrown error anyways - and removing the checking for this argument would make errors in programs less likely, as well as reduce the size of the mod. While this argument shouldn't be removed - that would break compatibility - there are various locations in the BIOs code that use "t" as this parameter, but it is useless.

Edit: In which case, binary chunks actually are enabled!

commented

The load function is just a placeholder for when we switch to Lua 5.2 (if ever). Once that happens, it will work.

and removing the checking for this argument would make errors in programs less likely, as well as reduce the size of the mod.

Using b in current ComputerCraft is wrong and should throw an error, and it really wouldn't decrease the size of the mod in any significant fashion. Imagine passing a binary dump into it, and it secretly interprets it as Lua source code; I'd very much like to know about that. Either way, we're already not complying with the Lua 5.2 standard by doing this, let's not make it worse.