Fix breakage of old Lua api. Fixes #5686.

introduced by #5305.