Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sham_heal = { 586,4,593,4,583,2,587,2,582,0,581,2,588,2,594,4,1648,2,591,0,592,4,590,0,2084,0,2060,1,1697,1,1696,2,2061,2,1698,0,2059,1,2063,4,2064,0,614,4,613,4,607,2 }
- ```lua
- for i = 1, #sham_heal, 2 do
- print(sham_heal[i], sham_heal[i+1])
- end
- ```
- ```lua
- function apply(func, arg_table, num_args)
- local unpack = unpack or table.unpack
- for i = 1, #arg_table, num_args do
- func(unpack(arg_table, i, i+num_args-1))
- end
- end
- apply(print, sham_heal, 2)
- ```
- ```lua
- function table_split(table_to_split, elements)
- local unpack = unpack or table.unpack
- local t = {}
- for i = 1, #table_to_split, elements do
- t[#t+1] = {unpack(table_to_split, i, i+elements-1)}
- end
- return t
- end
- for _, v in ipairs(table_split(sham_heal, 2)) do
- print(v[1], v[2])
- end
- ```
- ```lua
- function iterate_in_chunks(table_to_iterate, elements)
- local unpack = unpack or table.unpack
- local next_index = 1
- local function f()
- local index = next_index
- next_index = next_index+elements
- return unpack(table_to_iterate, index, next_index-1)
- end
- return f
- end
- for a,b in iterate_in_chunks(sham_heal, 2) do
- print(a,b)
- end
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement