Fixed wiki error

local variables in lua including functions are only accessible below where they are defined, causing an error in this code.