= Lua == String library functions (5.4) > for k,v in pairs(string) do print(k) end byte char dump find if you need the first match and its position format gmatch if you are interested in matches and want to iterate over them gsub if you substitute the matches ignoring their position match if you need all captures from the first match len lower pack packsize rep reverse sub unpack upper == metatable methods https://gist.github.com/oatmealine/655c9e64599d0f0dd47687c1186de99f __add(a, b) __sub(a, b) __mul(a, b) __div(a, b) __unm(a) __mod(a, b) Lua 5.1 __pow(a, b) Lua 5.1 __idiv(a, b) Lua 5.3 __band(a, b) Lua 5.3 __bor(a, b) Lua 5.3 __bxor(a, b) Lua 5.3 __bnot(a) Lua 5.3 __shl(a, b) Lua 5.3 __shr(a) Lua 5.3 __eq(a, b) __lt(a, b) __le(a, b) __concat(a, b) __len(a) Lua 5.1 __index(self, k) __newindex(self, key, value) __call(args) __mode __close(value, err?) Lua5.4 __gc() __tostring() __metatable __name __pairs == iterators -- example for an iterator -- NOTE: if your iterator handles tables, you might be interested in “next_key, next_value = next(tbl, previous_key)” or “nextval“ functions local steps = function (start, stop, step_by) local iter = start return function () local current = iter if current < stop then iter = iter + (step_by or 1) return current else return nil end end end for i in steps(3, 7, 1) do print(i) end