Fixed wiki error

local variables in lua including functions are only accessible below where they are defined, causing an error in this code.
Merge pull request #41 from MattJeanes/patch-1

Fixed wiki error