Cuberite Forum

Full Version: cIniFile help?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Ah, sorry forgot. It returns a list, and you can do like Player[1], player[2] and so on.
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
Arrays are 1-based. Smile

I didn't know that existed, is it in the global function helpers section on the wiki?
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
I just added itTongue That's why its there.
(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