04-21-2015, 05:55 AM
Well, if you wanna write to a .ini file (basically a fancy text file), here's some basic functions:
If you would like to access that value from disk, do this:
NumBlocks would then contain the 34 that was stored in the file earlier. If you look in the file at the set file path, you should see a file structured like this:
Hope this might have helped.
-- File path, the root starts at the MCServer executable local FilePath = "Plugins/SomePlugin/MyIniFile.ini" -- An integer that we want to store, let's say 34 local BlocksDestroyed = 34 -- Creates a .ini file object local SomeIniFile = cIniFile() -- Create a key for values to go under SomeIniFile:AddKeyName("BlocksBroken") -- Create a value under this key name SomeIniFile:SetValueI("BlocksBroken", "ValueNumber", BlocksDestroyed) -- Write the file to disk SomeIniFile:WriteFile(FilePath)
If you would like to access that value from disk, do this:
-- Read the file off of the disk SomeIniFile:ReadFile(FilePath) -- Set value of NumBlocks to the amount stored under the key name and that specific value name local NumBlocks = SomeIniFile:GetValueI("BlocksBroken", "ValueNumber")file
NumBlocks would then contain the 34 that was stored in the file earlier. If you look in the file at the set file path, you should see a file structured like this:
[BlocksBroken] ValueNumber=34
Hope this might have helped.