In that case, just do something like the following:
local input = read()
local letters = {} --A table which will contain each individual character
for i=1,#input do
letters[i] = string.sub(input, i, i) -- Basically just gets the individual character at the index i and puts it into the table
end
for i=1, #letters do
build(letters[i]) --For each of the letters, run the build function
end
The above code of course assumes that you have a build function.
Tables are probably the best way to handle the whole building part. In fact, considering that you can have functions inside of tables, something like this may be the easiest.
local build = {
["a"] = function()
--dostuff
end;
["b"] = function()
--do other stuff
end;
}
And then to build the letters, you would just do something like build.a() or build["a"]().
In the context of having a table of characters like in my first example, you would just change it to this:
local input = read()
local letters = {} --A table which will contain each individual character
for i=1,#input do
letters[i] = string.sub(input, i, i) -- Basically just gets the individual character at the index i and puts it into the table
end
for i=1, #letters do
build[letters[i]]()--For each of the letters, run the build function
end