| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<title>Lua plugin for Geany - The Keyfile Module</title> |
| 5 |
</head> |
| 6 |
<body style="margin: 32px 25% 24px 5%"> |
| 7 |
<hr><h2>The Keyfile module</h2><hr> |
| 8 |
<p> |
| 9 |
The <tt>keyfile</tt> module provides a minimal Lua wrapper around the GLib library's <tt><a href="http://www.gtk.org/api/2.6/glib/glib-Key-value-file-parser.html">GKeyFile</a></tt> object, |
| 10 |
for reading and writing of key-value file data, somewhat similar to MS-Windows <tt>*.INI</tt> files. |
| 11 |
</p> |
| 12 |
<p> |
| 13 |
This file format is used by Geany for various configuration and project files. |
| 14 |
Note that this module does not provide any functions for reading or writing disk files, |
| 15 |
it simply receives or returns its file data as a single continuous string. If you need to |
| 16 |
read or write a disk file, you can use Lua's built-in <tt>io</tt> module. |
| 17 |
</p><p> |
| 18 |
The functions are listed below... <br> |
| 19 |
Optional parameters are noted in [ square ] brackets. |
| 20 |
</p><p> |
| 21 |
For get/set style functions, calling the function <i>with</i> the optional parameter |
| 22 |
<i><u>assigns</u></i> a new value, calling the function <i>without</i> the optional |
| 23 |
parameter <i><u>returns</u></i> the current value.<br> |
| 24 |
</p><p> |
| 25 |
Note that you can also use these functions in object-oriented style:<br> |
| 26 |
For instance, <tt>keyfile.value(kf,"foo","bar")</tt> <br>can also be written |
| 27 |
as <tt>kf:value("foo","bar")</tt><br></p><br> |
| 28 |
|
| 29 |
|
| 30 |
<hr><tt><b><big>function keyfile.new ()</big></b></tt><br> |
| 31 |
<p>Creates a new, empty <tt>keyfile</tt> object.</p><br> |
| 32 |
|
| 33 |
<hr><tt><b><big>function keyfile.data ( kf [, text] )</big></b></tt> -- <small>get/set</small><br> |
| 34 |
<p>Returns or assigns the full text of the keyfile.</p><br> |
| 35 |
|
| 36 |
<hr><tt><b><big>function keyfile.groups ( kf )</big></b></tt><br> |
| 37 |
<p>Returns an iterator to list the groups within the keyfile.</p><br> |
| 38 |
|
| 39 |
<hr><tt><b><big>function keyfile.keys ( kf, group )</big></b></tt><br> |
| 40 |
<p>Returns an iterator to list the keys within the specified group.</p><br> |
| 41 |
|
| 42 |
<hr><tt><b><big>function keyfile.value ( kf, group, key [, value] )</big></b></tt> -- <small>get/set</small><br> |
| 43 |
<p>Returns or assigns the value of the specified key.</p><br> |
| 44 |
|
| 45 |
<hr><tt><b><big>function keyfile.comment ( kf, group, key [, comment] )</big></b></tt> -- <small>get/set</small><br> |
| 46 |
<p>Returns or assigns the comment for the specified key.<br> |
| 47 |
If <tt>key</tt> is nil, it gets/sets the group comment.<br> |
| 48 |
If <tt>group</tt> is nil, it gets/sets the comment for the file.<br> |
| 49 |
</p><br> |
| 50 |
|
| 51 |
<hr><tt><b><big>function keyfile.has ( kf, group [, key] )</big></b></tt><br> |
| 52 |
<p>Returns <tt>true</tt> if the specified group (and optionally the key) already exists.</p><br> |
| 53 |
|
| 54 |
<hr><tt><b><big>function keyfile.remove ( kf, group [, key] )</big></b></tt><br> |
| 55 |
<p>Deletes the key, if specified, else it deletes the entire group.</p><br> |
| 56 |
<hr> |
| 57 |
<br><br> |
| 58 |
<div align="right"><small>© 2007-2008 <i>Jeff Pohlmeyer </i> </small></div> |
| 59 |
<br><br> |
| 60 |
<br><br><br><br> |
| 61 |
</body> |
| 62 |
</html> |