GTA IV-MP fórum

Szkriptek/Ötletek => Pluginok, Programok és Kiegészítők => A témát indította: Azzeroth - március 22, 2013, 10:28:13 pm

Cím: PNil - INI Parser
Írta: Azzeroth - március 22, 2013, 10:28:13 pm
Üdv. fórumozók

Találtam egy kisebb kiegészítőt.
A kiegészítővel tudunk fájlba menteni, abból betölteni, abban változtatni értékeket,
Érdekességek, hogy tudunk benlőle betölteni értékeket, eltudjuk benne tárolni, változtatni tudjuk az értékét, a nevét,
tartalmaz frissítést átlehet benne nevezni a szekciókat, értékeket, frissíteni tudjuk, törölni is tudjuk a szekciókat, értékeket.

local fileHandle = pnil ("testfile"); -- calls the class pnil which opens the "testfile.pnil" in the files dir
fileHandle.constructor (filename) -- This is the first function that gets called - you just need the filename for that. if you dont put an extension, the class will add ".pnil" to it.

fileHandle.reload () -- Reloads and reinitializes the file
fileHandle.readf () -- Reads the full file content, you wont need that.
fileHandle.dataToFile () -- saves the data into the file: you dont need that, it is called after almost every command.
fileHandle.secExists (sectionName) -- Returns true if the section exists, false if not.
fileHandle.keyExists (key) -- Returns the section name of the key if it exists, false if not
fileHandle.renameKey (sectionName, keyName, newName) -- renames the key to a new name
fileHandle.renameSec (sectionName, newName) -- renames the section to a new name
fileHandle.setKey (sectionName, keyName, keyValue [, comment) -- Creates or sets the key value. If comment (optional) is set, a comment is added to the file
fileHandle.deleteSec (sectionName) -- deletes the specified section
fileHandle.deleteKey (sectionName, keyName) -- deletes the specified key in the section
fileHandle.getKey (sectionName, keyName[, defaultValue = null) -- returns the value of the Key keyName in the section sectionName, if it does not exist, it returns the defaultValue (optional parameter)

Letöltés:  Pnil - Ini (http://users.atw.hu/iv-mp/files/pnilini.nut)

Forrás: http://iv-multiplayer.com