tim

small extendable personal assistant
git clone git://edryd.org/tim
Log | Files | Refs | LICENSE

json-get.lua (264B)


      1 local json = require "json"
      2 
      3 local myarg = { }
      4 for s in string.gmatch(args, "%S+") do
      5    myarg[#myarg+1] = s
      6 end
      7 local file = myarg[1]
      8 local var = myarg[2]
      9 
     10 local f = io.open(file, "rb")
     11 local js = f:read("*all")
     12 f:close()
     13 local t = json.decode(js)
     14 
     15 return t[var]