cIniFile help?
#11
Ah, sorry forgot. It returns a list, and you can do like Player[1], player[2] and so on.
Reply
Thanks given by: NiLSPACE
#12
Actually MCServer already has a StringSplit() function that does more or less the same thing, but may be faster because it's native. It returns an AStringVector, which is exported to the Lua API so that you can use:
Code:
local Values = StringSplit(IniFile.Get(...), ",");  -- split by commas
local First = Values[0];
local Second = Values[1];
-- etc.
Not sure now if the arrar is zero-based or 1-based. But you already use that because it's how commands are handled Smile
Reply
Thanks given by:
#13
Arrays are 1-based. Smile

I didn't know that existed, is it in the global function helpers section on the wiki?
Reply
Thanks given by:
#14
Lua arrays are, but are these native arrays as well? That's the question.

It's in the globals, but no wonder noone notices it - the wiki page is almost unreachable:
http://www.mc-server.org/wiki/doku.php?i...in:globals
Reply
Thanks given by:
#15
I just added itTongue That's why its there.
Reply
Thanks given by:
#16
(04-07-2013, 02:17 AM)xoft Wrote: Lua arrays are, but are these native arrays as well? That's the question.

It's in the globals, but no wonder noone notices it - the wiki page is almost unreachable:
http://www.mc-server.org/wiki/doku.php?i...in:globals

It's not a native array, it is pushed to Lua as a Lua array effectively copying the entire thing.
Reply
Thanks given by:




Users browsing this thread: 5 Guest(s)