summaryrefslogtreecommitdiff
path: root/plugins/MirLua/docs/examples
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-06-11 00:44:38 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-06-11 00:44:38 +0000
commita15cfbf2d3abc5a66b394e2da551828d39994d51 (patch)
tree98bd51cf9f022484a38bd749cbb9f8a50939c516 /plugins/MirLua/docs/examples
parent8f2006898a4cf2e958df20b20e90de2ec762d40b (diff)
MirLua:
- added m_database module - added examples git-svn-id: http://svn.miranda-ng.org/main/trunk@14111 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/docs/examples')
-rw-r--r--plugins/MirLua/docs/examples/database.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/plugins/MirLua/docs/examples/database.lua b/plugins/MirLua/docs/examples/database.lua
new file mode 100644
index 0000000000..42625a4f64
--- /dev/null
+++ b/plugins/MirLua/docs/examples/database.lua
@@ -0,0 +1,28 @@
+--- include m_database module
+local db = require('m_database')
+
+--- Save value to database
+-- @param hContact The handle of contact (can be NULL)
+-- @param module The name of section
+-- @param setting The name of setting
+-- @return value The value
+db.WriteContactSetting(nil, 'MirLua', 'testByte', true)
+db.WriteContactSetting(nil, 'MirLua', 'testNum', -2342)
+db.WriteContactSetting(nil, 'MirLua', 'testString', "Hello!")
+
+--- Return value from database
+-- @param hContact The handle of contact (can be NULL)
+-- @param module The name of section
+-- @param setting The name of setting
+local str = db.GetContactSetting(nil, 'MirLua', 'testString');
+
+-- print string value if bool value is true
+if db.GetContactSetting(nil, 'MirLua', 'testByte') then
+ print(str)
+ end
+
+--- Delete value from database
+-- @param hContact The handle of contact (can be NULL)
+-- @param module The name of section
+-- @param setting The name of setting
+db.DeleteContactSetting(nil, 'MirLua', 'testString');