Okay, this is deeper than I thought, and I need more help!
I'm hoping to be able to use the table.concat to output a string but then I need to have that string get processed as code (because it's nested) to output the real string!
So my test example is this:
Code: Select all
function testPrint()
local t = {"H","a","v","e"," ","a"," ","n","i","c","e"," ","d","a","y","." }
local u = {}
for i=1,#t-1 do table.insert(u,"l()..") end
table.insert(u,"l()")
print(table.concat(u))
print(l()..l()..l()..l()..l()..l()..l()..l()..l()..l()..l()..l()..l()..l()..l()..l())
end
function l()
local letters = { "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z" }
return letters[math.random(1,#letters)]
end
What I want is for both print commands to print out a set of 16 random letters. Right now only the second print command does that; the first print command just prints out literally "l()..l()..l()..etc" as a string itself instead of processing that code to the final string.
I tried
but that's just the same thing.
So how can I get the code inside the print() to process TWICE before printing the resulting string?