Hello, Andre! Andre Caldas wrote:
function document.MyCharacterMess(str,filename)
What is this "str"?
This is a function that takes two variables; the first one it calls 'str', the second one 'filename'. Example: function f(a, b) return a/b end function(8,2) --> 4, not 0.25 I do not know what sort of str and filename are being passed to document.MyCharacterMess. (To all the action functions in utilities.sequencers.appendaction, in fact).
if file.nameonly(filename) == "ward" then str = table.concat(string.totable(str,"."), " + ")
What is this doing?
file.nameonly strips path and extenstion, e.g. file.nameonly('a/b/cod.doc') returns 'cod'. You can see the file.* functions in l-file.lua. string.totable splits a string, and returns the pieces as an array. In this case, the string is split at the periods. table.concat combines a table into a string, optionally putting a string (" + ", in this case) where the pieces join. so the `str = ...` line turns "Hello. I am Sam. You are also Sam." into "Hello + I am Sam + You are also Sam" or "hello.txt" into "hello + txt"
Why is "document.MyCharacterMess" a string? Isn't it less error-prone to use the function itself, instead of its name?
No idea. Cheers, and good luck, Sietse