Module:StringHelpers
Revision as of 12:48, 12 April 2020 by Administrator (talk | contribs) (Created page with "local p = {} function p.getParagraphFromQuestion(param) string = param.args[1] return string.find(s, '-', 1, true) end return p")
Module supports numbers with max 3 digits.
Tests
Simple question
| Expected | Actual |
|---|---|
| 150 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
| 15 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
| 7 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
| 150 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
| 15 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
| 7 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
Complex question
| Expected | Actual |
|---|---|
| 6 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
| 7 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
| 10 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
| 99 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
| 101 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
| 6 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
| 7 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
| 10 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
| 99 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
| 101 | Lua error at line 5: bad argument #1 to 'find' (string expected, got nil). |
local p = {}
function p.getParagraphFromQuestion(param)
string = param.args[1]
return string.find(s, '-', 1, true)
end
return p