• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua What is that lua stuff called..

Xikini

I whore myself out for likes
Senator
Premium User
Joined
Nov 17, 2010
Messages
6,788
Solutions
581
Reaction score
5,354
Where you tear apart a string into smaller peices?

like..

Player says: "50 canadian pizza's with extra mushrooms and shit"
scripts goes.. ok..
table[1] = 50
table[2] = canadian
table[3] = pizza's with extra mushrooms and shit

Thanks. :oops:

Xikini
 
you mean "split" / "explode"?

"split/explode an array"
Yes, Thank you.
Looks like I got some serious learning/testing ahead of me.
ROiXDcu.png


lua-users wiki: Split Join
 
You need to make your own splitting function, so what you might be looking for is string.gmatch using regular expressions
 
Lua:
string.explode = function(self, sep)
    local ret = {}
    for s in self:gmatch("([^".. sep .."]+)") do
        ret[#ret+1] = s
    end
    return ret
end
 
Back
Top