lua : correctly use dup version when naming temporary files

fix bug 9722