Advertisement
theoriginalbit

ccConfig: Example — Multi-Configs

Feb 14th, 2013
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. os.loadAPI("/ccConfig")
  2.  
  3. local config = ccConfig.new("config.cfg", "Multi-Config Example 1")
  4. local bindings = ccConfig.new("bindings.cfg", "Multi-Config Example 2")
  5. local running
  6. local key
  7.  
  8. local function loadSettings()
  9.   config:load()
  10.  
  11.   running = config:getBoolean("canRun", false)
  12.  
  13.   config:save()
  14.  
  15.   bindings:load()
  16.  
  17.   key = bindings:getNumber("doSomething", 200)
  18.  
  19.   bindings:save()
  20. end
  21.  
  22. loadSettings()
  23.  
  24. print("This should display whats in the configs:")
  25. print("canRun: "..tostring(running)) --> whats in config or false
  26. print("key binding: "..tostring(key)) --> whats in config or "Hello World"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement