DaveMcW wrote: Sat Oct 17, 2020 10:45 pm
A table that allows self-references is Turing complete.
This makes as much sense as saying that "philosophy is blue". Philosophy is an abstract concept that doesn't emit/reflect/diffuse light, so it doesn't have a color. Tables by themselves aren't a formalism to describe programs (or a machine able to execute a program), so tables can't be said to be Turing-complete (or not).
So let's formulate the problem precisely. When doing
game.print(someTable), the game reads someTable and a bunch of .cfg file to generate a string, which is then printed. So it can be said that "someTable" defines a program that takes a text input (the .cfg files), and generates a text output. Normally we'd have to also precise the validity domain of the "someTable" thing, and exactly how the conversion is done depending on the data in "someTable". But let's forget and just suppose that recursive tables are fine. So here's a good formulation of the problem: is the "LocalisedString" formalism for program description (which happen to be represented Lua table) Turing complete ?
If we take the article you linked, it presents multiple theorems to show that a language (= formalism) is Turing complete. For none of them, recursion is a
sufficient condition.
As a simple proof that the "LocalisedString" language is not Turing complete: it is not possible (to my knowledge) to write a "program" (= localised string) to remove/replace the last character/symbol of an input (= value in the .cfg file). Since such a program is possible on a Turing machine, The LocalisedString language is not Turing-complete.
DaveMcW wrote: Sat Oct 17, 2020 10:45 pm
Therefore you are asking Wube to solve the halting problem.
Even if the LocalisedString language was Turing-complete, the bug I presented is easily solvable. The halting problem states that there is no magic program M that takes any other program P and input I, and answer the question "does P(I) terminates ? Accepted answers: yes & no".
This does not prevent the existence of program that answers "does P(I) terminates ? Accepted answers: no & I don't know". For this bug, you just need to detect that you're about to call "translate(someTable)" again while you're still evaluating "translate(someTable)". There's no rocket science in that: Lua detects circular "require" easily for example.