String tokenization and replacing a numbered field
Don't use the expensive string.format where string.char can do it all.
You should accept a string (of length 1) as separator in tokenize and puttok, and have a default.
Swapping the middle two arguments of puttok allows you to default the replacement to "".
Your second conditional is useless, as it will always be taken: The first one results in a runtime-error if N is not a number.
I wonder why you don't use an early return there anyway?
First removing an element and then inserting a different one at the same index is really inefficient, resulting in a need to move all higher-numbered elements first down and then back.
Just replace it already:

tokens[n] = token

Try for better names, so you don't need to explain so much in comments:

tokenize(C, strng) =&gt; explode(delimiter, text)
puttok(text,token,N,C) =&gt; replace_token(text, which, replacement, delimiter)
-- Switched the middle two parameters of puttok/replace_token