Fix breakage of old Lua api. Fixes #5686.
Merge pull request #5690 from obrakmann/fix5686

Fix breakage of old Lua api. Fixes #5686.