0

I want to use Lua 4.0.1 instead of 5.2, because I have to parse 4.0.1 scripts.
The syntax of the generic for loop has been changed since then (with no backwards compatibility).

If this is not possible, are there any alternatives to NLua that support this?

PayDay
  • 1
  • 1
  • 1
    How did the for loop syntax change? I don't see much of a difference by looking at [4.0](https://www.lua.org/manual/4.0/manual.html#for%20statement) manual. – Paul Kulchenko Oct 03 '16 at 15:29
  • @PaulKulchenko Lua 4.0, and 5.0 in legacy, support `for namelist in exp do block end`, where the expression is a table. Lua 5.0/5.1 and later use iterator functions (`pairs/ipairs`). – Oka Oct 04 '16 at 01:08
  • It may be easier to convert the script before executing them if that's the only difference. – Paul Kulchenko Oct 04 '16 at 01:22
  • @PaulKulchenko How would you do that automatically? It has to work without any manual editing. – PayDay Oct 04 '16 at 17:12
  • You'd need to replace `in exp do` with `in ipairs(exp) do`, which shouldn't be too difficult. – Paul Kulchenko Oct 04 '16 at 17:18
  • So string manipulation, oh... Thanks, I'll try that. – PayDay Oct 04 '16 at 19:51

0 Answers0