string.insert

Share your scripts and packages with other Mudlet users.
Post Reply
Wingard
Posts: 9
Joined: Thu Jan 14, 2010 6:41 pm

string.insert

Post by Wingard »

I wrote this function a minute ago, didn't work quite how I wanted, but someone might find it useful.

Code: Select all

function string.insert(str, pos, new) 
return str:sub(1,pos)..new..str:sub(pos+1) 
end 
Works like this:
string.insert("012345", 0, "<red>")

<red>012345

Or at least, that's how it SHOULD work. You broke something otherwise.

Post Reply