This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, ...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local buf = {} | |
for i=#out_number,1,-1 do | |
table.insert(buf, out_number:sub(1, i)) | |
end | |
fsLog("MY VARIABLE", table.concat(buf, ", ")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |