string iteration iterable

UTF8 strings in Luart are iterable through the Luart helper function each(), returning the next character in the string with each loop iteration. Each iteration returns the character as a string.

Example

local console = require "console" console.write("\nEnter your name : ") local name = console.readln() console.write("\nLet me spell it... ") for char in each(name) do console.write("["..char.."] ") end console.write("\n")