Skip to content

Instantly share code, notes, and snippets.

@ToxicFrog
Forked from tbergeron/gist:3991160
Created November 1, 2012 02:03
Show Gist options
  • Save ToxicFrog/3991169 to your computer and use it in GitHub Desktop.
Save ToxicFrog/3991169 to your computer and use it in GitHub Desktop.
function staff.callFunctionForEachEmployee(functionName, ...)
if employee_instances then
for _,employee in pairs(employee_instances) do
employee[functionName](employee, ...)
end
end
end
-- or, for a more general approach
function callMethodOnEach(objects, method, ...)
for _,object in pairs(objects) do
object[method](object, ...)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment