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

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, " ")

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: 1329 / 454
Referenced in: [show references]