04-06-2013, 11:03 PM
Pages: 1 2
04-07-2013, 01:48 AM
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:
Not sure now if the arrar is zero-based or 1-based. But you already use that because it's how commands are handled 
Code:
local Values = StringSplit(IniFile.Get(...), ","); -- split by commas
local First = Values[0];
local Second = Values[1];
-- etc.

04-07-2013, 02:07 AM
Arrays are 1-based. 
I didn't know that existed, is it in the global function helpers section on the wiki?

I didn't know that existed, is it in the global function helpers section on the wiki?
04-07-2013, 02:17 AM
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 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
04-07-2013, 03:19 AM
I just added it
That's why its there.

04-07-2013, 03:39 AM
(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.
Pages: 1 2