rewrite Lua require function