Anyway this script could be easily fixed?
I'm getting this output when I run it
Sounds like Aki is correct on why it doesn't work, but I am not knowledgeable enough in lua scripting to fix it.
I would love to get this working, or an iteration where an admin can call a user and set their home directory, could be an excellent administration tool.