summaryrefslogtreecommitdiff
path: root/plugins/MirLua/docs
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-07-20 20:35:35 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-07-20 20:35:35 +0000
commit7d46e610c0c93d68cb28e51f42691b3a404f2f7e (patch)
tree54549257352c650dfdea3dcaec5e67abafff257b /plugins/MirLua/docs
parentab51bf5672d02978906a59ddf070ccc3f80921b8 (diff)
MirLua:
- added iterators in m_database and m_protocols - added more short aliases for functions in m_database - added some examples in m_database - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@14590 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/docs')
-rw-r--r--plugins/MirLua/docs/examples/database.lua29
1 files changed, 25 insertions, 4 deletions
diff --git a/plugins/MirLua/docs/examples/database.lua b/plugins/MirLua/docs/examples/database.lua
index 93c17cb818..033293e5c7 100644
--- a/plugins/MirLua/docs/examples/database.lua
+++ b/plugins/MirLua/docs/examples/database.lua
@@ -1,23 +1,44 @@
--- include m_database module
local db = require('m_database')
+--- Iterate all contact stored in db
+-- @param protoName The name of protocol account or nothing
+for hContact in db.AllContacts() do
+ --print(hContact)
+end
+
+local hContact = 15
+
+--- Iterate all contact events stored in db
+-- param hContact The handle of contact
+for hEvent in db.AllEvents(hContact) do
+ --print(hEvent)
+end
+
+--- Iterate all setting names stored in db
+-- param module The name of module
+-- param hContact The handle of contact or nothing
+for setting in db.AllSettings('CList') do
+ --print(setting)
+end
+
--- 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', 'testNum', -2342)
+db.WriteSetting(nil, 'MirLua', 'testNum', -2342)
--- 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
-- @param default The value which will be returned if setting doesn't not exists
-local bValue = db.GetContactSetting(nil, 'MirLua', 'testByte');
+local bValue = db.GetSetting(nil, 'MirLua', 'testByte');
-- print string value if bool value is true
if bValue then
- local sValue = db.GetContactSetting(nil, 'MirLua', 'testString', 'Hello!')
+ local sValue = db.GetSetting(nil, 'MirLua', 'testString', 'Hello!')
print(sValue)
end
@@ -25,4 +46,4 @@ if bValue then
-- @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', 'testNum');
+db.DeleteSetting(nil, 'MirLua', 'testNum');