09-13-2014, 06:12 AM
(This post was last modified: 09-13-2014, 10:51 PM by Seadragon91.)
Hey,
Does this fit to you?
With GetNumValues() from cIniFile you can get the amount of values from a key, then you can foor loop over it. I use this nice idea in my skyblock plugin for the challenenges.
Messages.ini
TestPlugin.lua
regards,
Seadragon91
Edit: Renamed l to line
Does this fit to you?
With GetNumValues() from cIniFile you can get the amount of values from a key, then you can foor loop over it. I use this nice idea in my skyblock plugin for the challenenges.
Messages.ini
Code:
[motd]
1=First motd
2=Second motd
[First motd]
1=Line 1
2=Line 2
[Second motd]
1=Line 1
2=Line 2
3=Line 3
TestPlugin.lua
PLUGIN = nil function Initialize(Plugin) Plugin:SetName("TestPlugin") Plugin:SetVersion(1) PLUGIN = Plugin local MessagesIni = cIniFile() MessagesIni:ReadFile(PLUGIN:GetLocalDirectory() .. "/Messages.ini") local amountMOTD = MessagesIni:GetNumValues("motd") for i = 1, amountMOTD do LOG(MessagesIni:GetValue("motd", i)) local motd = MessagesIni:GetValue("motd", i) local amountLines = MessagesIni:GetNumValues(motd) for line = 1, amountLines do LOG(MessagesIni:GetValue(motd, line)) end LOG("") end end
regards,
Seadragon91
Edit: Renamed l to line