Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #77 // dkjson test

Lua code

function loadDKJSON(sID)
  local env = setmetatable({}, {__index=function(o, k) return _G[k] end })
  return assert(loadSnippet(sID, env))()
end

json = loadDKJSON('#44')

print(json.encode{'hello', 'world'})
print(json.encode{a='hello', b=2})
t = json.decode('["hello","world"]')
print(t[1], t[2])

Author comment

works!! :)

test run  test run with input  download  show line numbers   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

Comments [hide]

ID Author/Program Comment Date
638 #1000610 Edit suggestion:
!636
!629

main {
static Object androidContext;
static String programID;

public static void main(String[] args) throws Exception {
function loadDKJSON(sID)
local env = setmetatable({}, {__index=function(o, k) return _G[k] end })
return assert(loadSnippet(sID, env))()
end

json = loadDKJSON('#44')

print(json.encode{'hello', 'world'})
print(json.encode{a='hello', b=2})
t = json.decode('["hello","world"]')
print(t[1], t[2])
}}
2015-08-19 01:45:38  delete 
636 #1000604 (pitcher) 2015-08-18 00:07:22

add comment

Image recognition results

Recognizer Recognition Result Visualize Recalc
#308 308 [visualize]

Snippet ID: #77
Snippet name: dkjson test
Eternal ID of this version: #77/1
Text MD5: 293b5e28e535f8879e6e4070a6764b8e
Author: stefan
Category: tests
Type: Lua code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2014-01-02 06:34:22
Source code size: 308 bytes / 11 lines
Pitched / IR pitched: Yes / Yes
Views / Downloads: 1230 / 721
Referenced in: [show references]