summaryrefslogtreecommitdiff
path: root/gamemode/server/database.lua
blob: 3a40fe5d0c2ee44dfe3832b8d41037dbbdd26ba2 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
--Provides an interface to store data in a database of some kind
--[[
Uses:
  GM.StorageMethod
    Can be: "Text", "Static Map", "LZWCompressed"
    If method is "Static Map", then GM.StoreageStaticMap must be a table of strings to string ID's.
  GM.StorageBackend
    Can be: "File"
  GM.StorageDebug
    Can be: true, false
    Enables extra debugging to find errors easily
]]

function loadTable(uniqueIdentifier)

  return nil
end

function storeTable(uniqueIdentifier, table)
  if(GM.StorageDebug) then
    print("Asked to store:")
    PrintTable(table)
  end
  if(GM.StorageDebug) then
    for k,v in pairs(tbl) do
      if(isfunction(v)) then
        print("Database.lua error: tried to save a table that has a function in it!")
        PrintTable(tbl)
        print("At field:")
        print(k)
      end
    end
  end

end

local function convertTableToText(tbl)
  if(GM.StorageMethod == "Text") then

  elseif(GM.StorageMethod == "Static Map") then

  elseif(GM.StorageMethod == "LZWCompressed") then

  else
    print("------------ERROR: database.lua----------")
    print("\tGM.StorageMethod is not a valid value!")
    print("Should be on of:\"Text\",\"Static Map\", or \"LZWCompressed\", but is:")
    print(GM.StorageMethod)
  end
end

local function convertTableStatic(tbl)
  if(GM.StorageStaticMap == nil) then
    print("---------ERROR: database.lua-----------")
    print("\tGM.StorageMethod is set to \"Static Map\", but GM.StoreageStaticMap is not defined!")
    return
  end


end