| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
function q_directory() |
| 11 |
return config.scriptdir .. "/quiz" |
| 12 |
end |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
function q_hide_unswer(input) |
| 17 |
local output = input |
| 18 |
for i = 1, #input do |
| 19 |
local c = input:sub(i,i) |
| 20 |
if not (c == " ") then |
| 21 |
output = replace_char(i, output, "*") |
| 22 |
end |
| 23 |
end |
| 24 |
return output |
| 25 |
end |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
function q_show_next_symbol(hidden, original) |
| 30 |
local output = hidden |
| 31 |
|
| 32 |
if hidden == original then |
| 33 |
return output |
| 34 |
end |
| 35 |
|
| 36 |
local replaced = false |
| 37 |
while not replaced do |
| 38 |
local i = math.random(#hidden) |
| 39 |
local c = hidden:sub(i,i) |
| 40 |
if c == "*" then |
| 41 |
local c2 = original:sub(i,i) |
| 42 |
output = replace_char(i, hidden, c2) |
| 43 |
replaced = true |
| 44 |
end |
| 45 |
end |
| 46 |
return output |
| 47 |
end |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
function q_compare_desc(a,b) |
| 53 |
return tonumber(a.points) > tonumber(b.points) |
| 54 |
end |