Upgrading to Lua 5.2

I want to put Lua 5.2 in the next release (whatever comes after 1.2.7) to get everyone on the new platform straight away. And to stamp out any incompatibilities early-on.

Here’s the list of incompatibilities
http://www.lua.org/manual/5.2/manual.html#8

Notable ones that will effect us are:

  • math.log10 deprecated
  • table.maxn deprecated
  • loadstring deprecated (now called load)
  • unpack is moved into table.unpack

We will probably add the following code to the sandbox (a Lua file that gets executed just before your code):

loadstring = load
math.log10 = function(x) return math.log(x,10) end
unpack = table.unpack
table.maxn = (function that replicates maxn)

Or we can just leave it and get you to change your own code to remain compatible.

I don’t care that much. As I said befor, everyone REALLY wants sprite packs… (hint hint)

And sockets, and text, and …

Ya… Well… You’ve seen my suggestions page.

I like the helpers so the old stuff works… but there’s a part of me that says

function loadstring()
   print "loadstring() is deprecated - use load() instead"
end

may be more painful, but better in the long run? I’m just concerned about hidden differences. Dunno. I can see the reasoning behind just making it work as well.

@Bortels - I actually like your solution better. Not keeping up with what is currently “correct” might be a problem some day. Especially since (at least currently), anyone can “correct” the code they might get from someone.

Bingo. Codea isn’t for playing Lua Apps - it’s for making them.

The wrapper code that ‘just works’ would be totally appropriate for a player app, where the user isn’t in a position to fix things. But with the editor there, I want it to tell me I’m using something no longer properly supported - it’ll prevent surprises when I go use my new Lua-hacking skills elsewhere.