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

24
LINES

< > BotCompany Repo | #66 // Wrapper for iterating chat lines

Lua code

1  
function loadFunctionOnInput(sID)
2  
  local env = {}
3  
  setmetatable(env, {__index=function(o, k) return _G[k] end })
4  
  return assert(loadSnippet(sID, env))
5  
end
6  
7  
sixtyone = loadFunctionOnInput("#61")
8  
9  
assert(lines)
10  
11  
results = {}
12  
for _, l in ipairs(lines) do
13  
  if not l.who:lower():find("^computer") then
14  
    input = l.text
15  
    print('Processing input: '..input)
16  
    local ok, result = pcall(sixtyone)
17  
    if ok and result then
18  
      print('Result: '..result)
19  
      table.insert(results, result)
20  
    end
21  
  end
22  
end
23  
24  
return table.concat(results, " ")

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
831 #1000610 Edit suggestion:
!636
!629

main {
static Object androidContext;
static String programID;

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

sixtyone = loadFunctionOnInput("#61")

assert(lines)

results = {}
for _, l in ipairs(lines) do
if not l.who:lower():find("^computer") then
input = l.text
print('Processing input: '..input)
local ok, result = pcall(sixtyone)
if ok and result then
print('Result: '..result)
table.insert(results, result)
end
end
end

return table.concat(results, " ")
}}
2015-08-19 22:47:37  delete 
810 #1000604 (pitcher) 2015-08-18 00:07:22

add comment

Image recognition results

Recognizer Recognition Result Visualize Recalc
#308 567 [visualize]

Snippet ID: #66
Snippet name: Wrapper for iterating chat lines
Eternal ID of this version: #66/1
Text MD5: 3df926e855e1f8cb3d2c2992bb776b39
Author: stefan
Category: wrappers
Type: Lua code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2013-12-31 20:50:03
Source code size: 567 bytes / 24 lines
Pitched / IR pitched: Yes / Yes
Views / Downloads: 1334 / 455
Referenced in: [show references]