summaryrefslogtreecommitdiff
path: root/plugins/MirLua/docs/examples/database.lua
blob: 33b6863322a742c9a433fc68acf8fca51c3337f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--- 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');

db.WriteContactSetting(nil, 'MirLua', 'ShowConsole', 1)