I'm committing these now.
see the extension tutorial. it describes all the types:
Wire Expression2 Extension Tutorial
also, try 'return foobar or ""'
will return "" if foobar is nil (or false) and foobar if not.
"It's easy to win forgiveness for being wrong; being right is what gets you into real trouble." - Bjarne Stroustrup
Lífið læðist lúmskt áfram
I'm committing these now.
"It's easy to win forgiveness for being wrong; being right is what gets you into real trouble." - Bjarne Stroustrup
Lífið læðist lúmskt áfram
I think an implode and a reverse string function could be useful. I've taken the time to make them, and they work. The reverse()-function returns the string you input reversed, and the implode()-function takes an array and returns all the cells as a string. The opposite of explode.
syntax:
S:reverse()
R:implode(S) or R:implode()
lua Code:
e2function string string:reverse() return string.reverse(this) end e2function string array:implode(string that) if !this then return "" end Tbl = {} for k,v in pairs(this) do table.insert(Tbl,tostring(v)) end return string.Implode(that,Tbl) end e2function string array:implode() if !this then return "" end Tbl = {} for k,v in pairs(this) do table.insert(Tbl,tostring(v)) end return string.Implode("",Tbl) end
Last edited by Matte; 07-05-2009 at 06:17 AM.
"If anybody says he can think about quantum physics without getting giddy, that only shows he has not understood the first thing about them."
-- Niels Bohr
Wire FPGA
we already have implode. it's named concat.
and as I told Jeremydeath before you, E2 strings are never nil, so this check in E:reverse is superfluous.
"It's easy to win forgiveness for being wrong; being right is what gets you into real trouble." - Bjarne Stroustrup
Lífið læðist lúmskt áfram
Ah, ok! Then it's no need for the implode function. Heh, I didn't even know there was such a function.
"If anybody says he can think about quantum physics without getting giddy, that only shows he has not understood the first thing about them."
-- Niels Bohr
Wire FPGA
Bookmarks