How to pull a record inside a function
Once you are inside a function how do you pull a record?
Here in this function I have nodeTrait which is user data for some racial traits. The text inside the nodeTrait is 3 disciplines
The while statements add the 3 disciplines to a list. Then the for statement runs until its at the end of the list. So far so good.
My problem is on the addDisciplines function I get no record exist. Because I am not calling the record correctly. How would I call a record from inside a function like this?
DB.getchildren? DB.setvalue?
I was thinking something like
addDiscipline(nodeChar, "referencediscipline", DB.setvalue(nodeChar, sRecord=refrence.disciplines.v);
But I don't know the proper syntax for it.
function handleClanDisciplines(nodeChar, sClass, nodeTrait)
local sText = DB.getText(nodeTrait, "text");
local aWords = StringManager.parseWords(sText);
local sDisciplines = {};
local ListDisciplines = DataCommon.disciplines;
local sFormat = Interface.getString("char_message_clanadd");
local sMsg = string.format(sFormat, "test", DB.getValue(nodeChar, "name", ""));
local i = 1;
local number = 0;
while aWords[i] do
if StringManager.isPhrase(aWords, i, { "three", "dots", "on" }) then
local j = i + 3;
while aWords[j] do
local k = 1;
while ListDisciplines[k] do
if aWords[j]:match(ListDisciplines[k]) then
table.insert(sDisciplines, aWords[j]);
number = number + 1;
break;
end
k = k + 1;
end
if not StringManager.isWord(aWords[j], "and" or "or") and not flag == 3 then
break;
end
j = j + 1;
end
break;
end
i = i + 1;
end
if #sDisciplines == 0 then
return false;
end
for _,v in ipairs(sDisciplines) do
addDiscipline(nodeChar, "referencediscipline", v);
end
return true;
end