Skip to content

Instantly share code, notes, and snippets.

View ToxicFrog's full-sized avatar

B. Kelly ToxicFrog

  • Google
  • Kitchener, Ontario
View GitHub Profile
math.randomseed(os.time())
local keys = { "A", "B", "start", "select", "up", "down", "left", "right" }
function randkey()
local key = keys[math.random(1,8)]
local input = joypad.get(1)
input[key] = true
joypad.set(1, input)
end
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, ...)
local buf = {}
for i=#out_number,1,-1 do
table.insert(buf, out_number:sub(1, i))
end
fsLog("MY VARIABLE", table.concat(buf, ", "))