Skip to content

Instantly share code, notes, and snippets.

@deontologician
Created October 14, 2011 00:58
Show Gist options
  • Save deontologician/1285974 to your computer and use it in GitHub Desktop.
Save deontologician/1285974 to your computer and use it in GitHub Desktop.
Closure example
function hailIfCargoMatches(lookingFor, specialHail)
function closure(event, data)
local cargoname,_,_ = unpack(data)
if cargoname:find(lookingFor, 1, true) then
sendChat(specialHail,"PRIVATE",currentTarget)
end
end
return closure
end
registerEvent(hailIfCargoMatches('Emergency','Do you have an emergency?'),TARGET_SCANNED)
registerEvent(hailIfCargoMatches('Valuable Stones','Prepare to be boarded, I want those stones!'),TARGET_SCANNED)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment