Source: site.view [edit]
Function name: wordGameChapSec
Arguments: chapter,section,name
Description: plays a game using vocab from chapter, section or "*" Name = player's name
Page type: webl
Render function:   wordGameRender
Module: noahGames

Page source:

var funcs = Wub_GetFunctionsByTag("flag.langdata2");

var vocabLines = [];
every f in funcs do
   var fi = Wub_GetFunctionInfo(f);
   var flags = Str_Split(Str_Trim(fi.oldflags), ",");
   if (Size(flags) == 3) then
      if ((flags[1] == chapter) or (chapter == "*")) and ((flags[2] == section) or (section == "*")) then
         vocabLines = vocabLines + Str_Split(Str_Trim(fi.exec), "\n");
      end
   end
end;

var rndSort = fun(a, b)
   var n = Wub_RandomInt(3) - 1;
   return n
end;


if true then
   vocabLines = Sort(vocabLines, rndSort)
end;

wubvars.gameLines := vocabLines;

WubCall("wordGameTestLine", [chapter, section, name, 1, 0, 0]);