Bug #289

dynamite.lua not compatible with Lua 5.2

Added by Spyhawk over 6 years ago. Updated over 5 years ago.

Status:Fixed% Done:

100%

Priority:Normal
Assignee:Spyhawk
Category:Lua scripts
Target version:ET: Legacy Development - ALL

Description

The current dynamite.lua isn’t compatible with Lua 5.2.

The following looping error is displayed in console:
Lua API: et_RunFrame error running lua script: [string "dynamite.lua"]:139: attempt to call field 'foreach’ (a nil value)

Seems Lua 5.2 does not ignore empty field in loop anymore.

dynamite.lua - dynamite.lua 1.41 (Lua 5.2 compatible version) (7.73 KB) Phenomenon, 11.04.2013 22:55

Associated revisions

Revision daba4deb
Added by Radegast over 5 years ago

dynatimer: lua 5.2 compatibility added by Phenomenon, fixes #289

History

#1 Updated by Radegast over 6 years ago

  • Category set to Lua scripts

#2 Updated by Phenomenon over 6 years ago

'table.foreach’ was deprecated in Lua 5.1, so it’s removed in Lua 5.2. You should use 'for key,value in pairs(table) do ... end’ instead.

I’ve attached a untested modified version of dynamite.lua. Please try it and give some feedback ...

#3 Updated by Spyhawk over 6 years ago

Phenomenon wrote:

'table.foreach’ was deprecated in Lua 5.1, so it’s removed in Lua 5.2. You should use 'for key,value in pairs(table) do ... end’ instead.

I’ve attached a untested modified version of dynamite.lua. Please try it and give some feedback ...

Thank a lot. benny_the_jet also sent me a modified version, but I haven’t tested it yet.

#4 Updated by Phenomenon over 6 years ago

Spyhawk wrote:

Thank a lot. benny_the_jet also sent me a modified version, but I haven’t tested it yet.

There’s also a "dc.lua" script around the WWW. Created by Necromancer and adapted by IRATA for NoQuarter. This should work fine with Lua 5.2.

#5 Updated by Spyhawk over 6 years ago

  • Assignee set to Spyhawk

#6 Updated by Dragonji over 6 years ago

Why can’t you use Lua 5.1?

#7 Updated by Spyhawk over 6 years ago

Dragonji wrote:

Why can’t you use Lua 5.1?

Sure I can, but that’s not the point. Lua 5.2 has been released in December 2011. It breaks ABI, but is likely to be shipped as default on most Linux distribution once the major libraries are made compatible (5.2 is already the default on my distribution). On the medium term, we have to ensure that scripts in the repo work with both Lua 5.1 and 5.2, and we’ll have to care only about 5.2 on the long term.

#8 Updated by Radegast over 5 years ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Applied in changeset etlegacy-lua|commit:daba4deb4fdc499f1de03d78fceb2568684cf8f9.

#9 Updated by Radegast over 5 years ago

  • Status changed from Fixed to New
  • % Done changed from 100 to 0

Phenomenon wrote:

I’ve attached a untested modified version of dynamite.lua. Please try it and give some feedback ...

It took a bit longer than you probably expected, but I tested and committed your script (I only had to change b 8 to cpm and enabled dynatimer by default). Thank you!

#10 Updated by Radegast over 5 years ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Also available in: Atom PDF