[lua] Improve the handling of lua and luajit output
The commit 3aa4202c has addressed the issues with luajit backend not working at all (even print(5+5) didn't work) and also making all current tests for lua working again. After the further analysis it turned out the implementation that was removed in that commit properly handles the output of lua and not of luajit. Working with lua is broken now in 23.04. Since we have luajit as the recommended version of lua, we keep this change for now but we need to improve the code and to handle both versions.
The initial discussion around the previous implementation has happened in https://phabricator.kde.org/D12074. The test project lua-backend-test.cws has several nice/nasty examples that are causing issues for the old and for the new implementation with lua or with luajit. The previous implementation was handling lua better but failed completely with luajit, the new one is doing better with luajit but fails in many cases with lua.