I used the basic 3.5 version code given, but found one drawback: When you want to change the wallpaper, you have to put the wallpaper image in the appropriate folder AND manually add the filename to your rc.lua file; the reverse if you want to remove a wallpaper. Why not just be able to add the file to the directory and let Awesome figure out the reset?
I wrote a script called wallpaper_to_array and put it in my PATH:
#!/usr/bin/env zsh
FILES="\"$(ls -l $1*jpg | cut -d '/' -f 6 | tr "\n" " ")"
FILES2="$(echo ${FILES//' '/'","'} | rev | cut -c 3- | rev)"
FILES="\"$(ls -l $1*jpg | cut -d '/' -f 6 | tr "\n" " ")"
FILES2="$(echo ${FILES//' '/'","'} | rev | cut -c 3- | rev)"
printf 'wp_path = '\""$1"\""\n"'wp_files = { '$FILES2' }'"\n"
This could probably be cleaned up a bit, but it works on my system. Then I replaced the lines in rc.lua that began "wp_path = ..." and "wp_files = ..." with
awful.util.eval(awful.util.pread("wallpaper_to_array /path/to/wallpapers/"))
Basically this used a zsh script to create a string that can be evaluated as Lua code in the rc.lua file, at Awesome's initialization.
Now all I have to do is add/remove the wallpaper image and restart AwesomeWM!