Reputation: 1147
how can I use title
in shortdesc
?
This fails:
function descriptor()
return {
title = "This";
shortdesc = title .. " is my text."
}
end
Upvotes: 3
Views: 58
Reputation: 41220
Paul is correct. You can also construct the table in pieces:
function descriptor()
local t = {}
t.title = "This";
t.shortdesc = t.title .. " is my text."
return t
end
Upvotes: 4
Reputation: 26794
You can't; you can use a local variable though:
function descriptor()
local title = "This"
return {
title = title;
shortdesc = title .. " is my text."
}
end
Upvotes: 4