Creeper9207, on 05 January 2017 - 09:14 PM, said:
... meaning that (line 89-94 in pastebin, example 1, line 11-15 in text post) is not doing it's job, but IS called.
No, those lines
aren't being called. If the term "function" existed anywhere within the strings in the "lines" table they would be, which would likewise lead to the final loop in the render() function doing something.
A couple of notes; in a conditional test, nil counts as false, and anything that is
not nil/false counts as true. You can hence replace this sort of thing:
if beginp ~= nil then
... with this sort of thing:
if beginp then
... whereas "not beginp" would resolve as true if beginp were nil or false.
This loop here is redundant:
for i = beginp, endp do
lines[k]=string.gsub(lines[k],'function',' ')
end
... and could be shortened to just:
lines[k] = v:gsub('function',' ')
... though either way you'll only be able to highlight one instance of "function" per string; I assume that's not a problem for your purposes.
makeRenderObjects() is a redundant function - you only ever call it from one place in your code, inside the render() function, so why not just put its code
in the render() function? Don't try to use function definitions in place of comments; making people scroll up and down to read linear code is annoying.