Last edit: @dye in #hi 5 days ago - Slack Archive

t1

'

History

Revision: 5066 by @dye in #hi 5 days agoSlack Archive

t1

'

Revision: 5065 by @dye in #hi 5 days agoSlack Archive

t1

'

Revision: 3829 by @dye in #hi 8 months agoSlack Archive

{lua}
local a="hi"function getAllMainContent()local b=[[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]local c={b,"Community Knowledge is in the *PINNED* files.","There are hidden treasure in this channel; Can *YOU* find them?","Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?","I heared I can get help with my visa in this channel, is that true?"}return c end;function getMainContent()local c=getAllMainContent()local d=math.random(1,table.getn(c))if channel.name==a then return c[d]else return c[1]end end;function printMainContent()print(getMainContent())end;function printArray(e)for d=1,#e do print(string.format("\n%d=========\n",d))print(e[d])print(string.format("\n%d=========\n",d))end end;function printAllMainContent()local f=getAllMainContent()printArray(f)end;function getData()local g=[[
[{"title":"Zero-Knowledge-Transmission is the core Pedagogic Philosophy of `42`.","content":"","source":"[42 Africa In Tech Kwame Yamgnane](https://www.youtube.com/watch?v=GRYrywkxe3o)"},{"title":"t2","content":"c2","source":"s2"}]
]]local h=[[
[{"title":"Plain repetition is dull; a bit of randomness brings some fun.","content":"","source":""},{"title":"According to Adam Grant's study, the `worst` performers in an organization are `Givers`.","content":"Guess who are the `best` performers? ","source":"Learn more about [Takers, Matchers, and Givers](https://www.youtube.com/watch?v=YyXRYgjQXX0)"},{"title":"nt3","content":"c3","source":""}]
]]local i=json.load(g)local j=json.load(h)local k=table.getn(i)local l=table.getn(j)local m=k+l;return i,k,j,l,m end;function printDYKArray(e)local n;for d=1,#e do print(string.format("\n%d=========\n",d))n=e[d]print(string.format("\n*%s*\n%s\n%s\n",n.title,n.content,n.source))print(string.format("\n%d=========\n",d))end end;function printAllDYK()local i,k,j,l,m=getData()print(string.format("\n=====FT=====\n"))printDYKArray(i)print(string.format("\n====NFT=====\n"))printDYKArray(j)end;function getRandomItem()local i,k,j,l,m=getData()local d=math.random(1,m)if d<=k then return i[d]else return j[d-k]end end;function getItem()return getRandomItem()end;function printDidYouKnow()local n=getItem()print(string.format("\n*%s*\n%s\n%s\n",n.title,n.content,n.source))end;function main()if args=="reset"then resetHistory()print("History has been reset.\n")return elseif args=="printAllMainContent"then printAllMainContent()return elseif args=="all"then printAllMainContent()printAllDYK()return end;printMainContent()print("\n============\n*Did You Know?*\n============")printDidYouKnow()end;main()

Revision: 3828 by @dye in #hi 8 months agoSlack Archive

{lua}
local a="hi"function getAllMainContent()local b=[[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]local c={b,"Community Knowledge is in the *PINNED* files.","There are hidden treasure in this channel; Can *YOU* find them?","Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?","I heared I can get help with my visa in this channel, is that true?"}return c end;function getMainContent()local c=getAllMainContent()local d=math.random(1,table.getn(c))if channel.name==a then return c[d]else return c[1]end end;function printMainContent()print(getMainContent())end;function printArray(e)for d=1,#e do print(string.format("\n%d=========\n",d))print(e[d])print(string.format("\n%d=========\n",d))end end;function printAllMainContent()local f=getAllMainContent()printArray(f)end;function getData()local g=[[
[{"title":"Zero-Knowledge-Transmission is the core Pedagogic Philosophy of `42`.","content":"","source":"[42 Africa In Tech Kwame Yamgnane](https://www.youtube.com/watch?v=GRYrywkxe3o)"},{"title":"t2","content":"c2","source":"s2"}]
]]local h=[[
[{"title":"Plain repetition is dull; a bit of randomness brings some fun.","content":"","source":""},{"title":"nt2","content":"According to Adam Grant's study, the *worst* performers in an organization are `Givers`. Guess who are the *best* performers? ","source":"Learn more about [Takers, Matchers, and Givers](https://www.youtube.com/watch?v=YyXRYgjQXX0)"},{"title":"nt3","content":"c3","source":""}]
]]local i=json.load(g)local j=json.load(h)local k=table.getn(i)local l=table.getn(j)local m=k+l;return i,k,j,l,m end;function printDYKArray(e)local n;for d=1,#e do print(string.format("\n%d=========\n",d))n=e[d]print(string.format("\n*%s*\n%s\n%s\n",n.title,n.content,n.source))print(string.format("\n%d=========\n",d))end end;function printAllDYK()local i,k,j,l,m=getData()print(string.format("\n=====FT=====\n"))printDYKArray(i)print(string.format("\n====NFT=====\n"))printDYKArray(j)end;function getRandomItem()local i,k,j,l,m=getData()local d=math.random(1,m)if d<=k then return i[d]else return j[d-k]end end;function getItem()return getRandomItem()end;function printDidYouKnow()local n=getItem()print(string.format("\n*%s*\n%s\n%s\n",n.title,n.content,n.source))end;function main()if args=="reset"then resetHistory()print("History has been reset.\n")return elseif args=="printAllMainContent"then printAllMainContent()return elseif args=="all"then printAllMainContent()printAllDYK()return end;printMainContent()print("\n============\n*Did You Know?*\n============")printDidYouKnow()end;main()

Revision: 3827 by @dye in #hi 8 months agoSlack Archive

{lua}
local a="hi"function getAllMainContent()local b=[[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]local c={b,"Community Knowledge is in the *PINNED* files.","There are hidden treasure in this channel; Can *YOU* find them?","Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?","I heared I can get help with my visa in this channel, is that true?"}return c end;function getMainContent()local c=getAllMainContent()local d=math.random(1,table.getn(c))if channel.name==a then return c[d]else return c[1]end end;function printMainContent()print(getMainContent())end;function printArray(e)for d=1,#e do print(string.format("\n%d=========\n",d))print(e[d])print(string.format("\n%d=========\n",d))end end;function printAllMainContent()local f=getAllMainContent()printArray(f)end;function getData()local g=[[
[{"title":"Zero-Knowledge-Transmission is the core Pedagogic Philosophy of `42`.","content":"","source":"[42 Africa In Tech Kwame Yamgnane](https://www.youtube.com/watch?v=GRYrywkxe3o)"},{"title":"t2","content":"c2","source":"s2"}]
]]local h=[[
[{"title":"nt1","content":"c1","source":"s1"},{"title":"nt2","content":"c2","source":"s2"},{"title":"nt3","content":"c3","source":""}]
]]local i=json.load(g)local j=json.load(h)local k=table.getn(i)local l=table.getn(j)local m=k+l;return i,k,j,l,m end;function printDYKArray(e)local n;for d=1,#e do print(string.format("\n%d=========\n",d))n=e[d]print(string.format("\n*%s*\n%s\n%s\n",n.title,n.content,n.source))print(string.format("\n%d=========\n",d))end end;function printAllDYK()local i,k,j,l,m=getData()print(string.format("\n=====FT=====\n"))printDYKArray(i)print(string.format("\n====NFT=====\n"))printDYKArray(j)end;function getRandomItem()local i,k,j,l,m=getData()local d=math.random(1,m)if d<=k then return i[d]else return j[d-k]end end;function getItem()return getRandomItem()end;function printDidYouKnow()local n=getItem()print(string.format("\n*%s*\n%s\n%s\n",n.title,n.content,n.source))end;function main()if args=="reset"then resetHistory()print("History has been reset.\n")return elseif args=="printAllMainContent"then printAllMainContent()return elseif args=="all"then printAllMainContent()printAllDYK()return end;printMainContent()print("\n============\n*Did You Know?*\n============")printDidYouKnow()end;main()

Revision: 3826 by @dye in #hi 8 months agoSlack Archive

{lua}

local a="hi"function getAllMainContent()local b=[[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]local c={b,"Community Knowledge is in the *PINNED* files.","There are hidden treasure in this channel; Can *YOU* find them?","Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?","I heared I can get help with my visa in this channel, is that true?"}return c end;function getMainContent()local c=getAllMainContent()local d=math.random(1,table.getn(c))if channel.name==a then return c[d]else return c[1]end end;function printMainContent()print(getMainContent())end;function printArray(e)for d=1,#e do print(string.format("\n%d=========\n",d))print(e[d])print(string.format("\n%d=========\n",d))end end;function printAllMainContent()local f=getAllMainContent()printArray(f)end;function getData()local g=[[
[
      {
        "title": "Zero-Knowledge-Transmission is the core Pedagogic Philosophy of `42`",
        "content": "",
        "source": "[42 Africa In Tech Kwame Yamgnane](https://www.youtube.com/watch?v=GRYrywkxe3o)"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      }
]

]]local h=[[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      }
]
]]local i=json.load(g)local j=json.load(h)local k=table.getn(i)local l=table.getn(j)local m=k+l;return i,k,j,l,m end;function printDYKArray(e)local n;for d=1,#e do print(string.format("\n%d=========\n",d))n=e[d]print(string.format("\n*%s*\n%s\n%s\n",n.title,n.content,n.source))print(string.format("\n%d=========\n",d))end end;function printAllDYK()local i,k,j,l,m=getData()print(string.format("\n=====FT=====\n"))printDYKArray(i)print(string.format("\n====NFT=====\n"))printDYKArray(j)end;function getRandomItem()local i,k,j,l,m=getData()local d=math.random(1,m)if d<=k then return i[d]else return j[d-k]end end;function getItem()return getRandomItem()end;function printDidYouKnow()local n=getItem()print(string.format("\n*%s*\n%s\n%s\n",n.title,n.content,n.source))end;function main()if args=="reset"then resetHistory()print("History has been reset.\n")return elseif args=="printAllMainContent"then printAllMainContent()return elseif args=="all"then printAllMainContent()printAllDYK()return end;printMainContent()print("\n============\n*Did You Know?*\n============")printDidYouKnow()end;main()

Revision: 3825 by @dye in #hi 8 months agoSlack Archive

{lua}

local channelName = "hi"
function getAllMainContent()

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    full,
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?",
    "I heared I can get help with my visa in this channel, is that true?"
  }

  return responses
end

function getMainContent()
  local responses = getAllMainContent();
  local i = math.random(1, table.getn(responses))
  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(responses[1])
  end
end

function printMainContent()
  print(getMainContent())
end

function printArray(arr)
  for i=1, #arr do
    print(string.format("\n%d=========\n", i))
    print(arr[i])
    print(string.format("\n%d=========\n", i))
  end
end

function printAllMainContent()

  local all = getAllMainContent()
  printArray(all)
end

function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "Zero-Knowledge-Transmission is the core Pedagogic Philosophy of `42`",
        "content": "",
        "source": "[42 Africa In Tech Kwame Yamgnane](https://www.youtube.com/watch?v=GRYrywkxe3o)"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      }
]

]]
  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      }
]
]]
  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end

function printDYKArray(arr)
  local item
  for i=1, #arr do
    print(string.format("\n%d=========\n", i))
    item = arr[i]
    print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
    print(string.format("\n%d=========\n", i))
  end
end

function printAllDYK()
  local ft, n_ft, nft, n_nft, n_total = getData()
  print(string.format("\n=====FT=====\n"))
  printDYKArray(ft)
  print(string.format("\n====NFT=====\n"))
  printDYKArray(nft)
end

function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end
end

function getItem()
  return getRandomItem()
end

function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
      resetHistory() 
      print("History has been reset.\n")
      return
  elseif (args == "printAllMainContent") then
      printAllMainContent()
      return
  elseif (args == "all") then
      printAllMainContent()
      printAllDYK()
      return
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3824 by @dye in #hi 8 months agoSlack Archive

{lua}

local channelName = "hi"
function getAllMainContent()

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    full,
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?",
    "I heared I can get help with my visa in this channel, is that true?"
  }

  return responses
end

function getMainContent()
  local responses = getAllMainContent();
  local i = math.random(1, table.getn(responses))
  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(responses[1])
  end
end

function printMainContent()
  print(getMainContent())
end

function printArray(arr)
  for i=1, #arr do
    print(string.format("\n%d=========\n", i))
    print(arr[i])
    print(string.format("\n%d=========\n", i))
  end
end

function printAllMainContent()

  local all = getAllMainContent()
  printArray(all)
end

function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "*Zero-Knowledge-Transmission* is the core Pedagogic Philosophy of `42`",
        "content": "",
        "source": "[42 Africa In Tech Kwame Yamgnane](https://www.youtube.com/watch?v=GRYrywkxe3o)"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      }
]

]]
  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      }
]
]]
  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end

function printDYKArray(arr)
  local item
  for i=1, #arr do
    print(string.format("\n%d=========\n", i))
    item = arr[i]
    print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
    print(string.format("\n%d=========\n", i))
  end
end

function printAllDYK()
  local ft, n_ft, nft, n_nft, n_total = getData()
  print(string.format("\n=====FT=====\n"))
  printDYKArray(ft)
  print(string.format("\n====NFT=====\n"))
  printDYKArray(nft)
end

function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end
end

function getItem()
  return getRandomItem()
end

function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
      resetHistory() 
      print("History has been reset.\n")
      return
  elseif (args == "printAllMainContent") then
      printAllMainContent()
      return
  elseif (args == "all") then
      printAllMainContent()
      printAllDYK()
      return
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3823 by @dye in #hi 8 months agoSlack Archive

{lua}

local channelName = "hi"
function getAllMainContent()

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    full,
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?",
    "I heared I can get help with my visa in this channel, is that true?"
  }

  return responses
end

function getMainContent()
  local responses = getAllMainContent();
  local i = math.random(1, table.getn(responses))
  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(responses[1])
  end
end

function printMainContent()
  print(getMainContent())
end

function printArray(arr)
  for i=1, #arr do
    print(string.format("\n%d=========\n", i))
    print(arr[i])
    print(string.format("\n%d=========\n", i))
  end
end

function printAllMainContent()

  local all = getAllMainContent()
  printArray(all)
end

function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "*Zero-Knowledge-Transmission* is the core Pedagogic Philosophy of `42`",
        "content": "",
        "source": "[42 Africa In Tech Kwame Yamgnane](https://www.youtube.com/watch?v=GRYrywkxe3o)"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      }
]

]]
  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      }
]
]]
  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end

function printDYKArray(arr)
  local item
  for i=1, #arr do
    print(string.format("\n%d=========\n", i))
    item = arr[i]
    print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
    print(string.format("\n%d=========\n", i))
  end
end

function printAllDYK()
  local ft, n_ft, nft, n_nft, n_total = getData()
  print(string.format("\n=====FT=====\n"))
  printArray(ft)
  print(string.format("\n====NFT=====\n"))
  printArray(nft)
end

function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end
end

function getItem()
  return getRandomItem()
end

function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
      resetHistory() 
      print("History has been reset.\n")
      return
  elseif (args == "printAllMainContent") then
      printAllMainContent()
      return
  elseif (args == "all") then
      printAllMainContent()
      printAllDYK()
      return
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3822 by @dye in #hi 8 months agoSlack Archive

{lua}

local channelName = "hi"

function getAllMainContent()

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    full,
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?",
    "I heared I can get help with my visa in this channel, is that true?"
  }

  return responses
end

function getMainContent()

  

  local responses = getAllMainContent();

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(responses[1])
  end
end



function printMainContent()
  print(getMainContent())
end

function printArray(arr)
  for i=1, #arr do
    print(string.format("\n%d=========\n", i))
    print(arr[i])
    print(string.format("\n%d=========\n", i))
  end
end

function printAllMainContent()

  local all = getAllMainContent()
  printArray(all)
end


function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "*Zero-Knowledge-Transmission* is the core Pedagogic Philosophy of `42`",
        "content": "",
        "source": "[42 Africa In Tech Kwame Yamgnane](https://www.youtube.com/watch?v=GRYrywkxe3o)"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      }
]
]]
  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end

function printAllDYK()
  local ft, n_ft, nft, n_nft, n_total = getData()
  print(string.format("\n=====FT=====\n"))
  printArray(ft)
  print(string.format("\n====NFT=====\n"))
  printArray(nft)
end

function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end
end

function getItem()
  return getRandomItem()
end

function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
      resetHistory() 
      print("History has been reset.\n")
      return
  elseif (args == "printAllMainContent") then
      printAllMainContent()
      return
  elseif (args == "all") then
      printAllMainContent()
      printAllDYK()
      return
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3821 by @dye in #hi 8 months agoSlack Archive

{lua}

local channelName = "hi"

function getAllMainContent()

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    full,
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?",
    "I heared I can get help with my visa in this channel, is that true?"
  }

  return responses
end

function getMainContent()

  

  local responses = getAllMainContent();

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(responses[1])
  end
end



function printMainContent()
  print(getMainContent())
end


function printAllMainContent()

  local all = getAllMainContent()
  for i=1, #all do
    print(string.format("\n%d=========\n", i))
    print(all[i])
    print(string.format("\n%d=========\n", i))
  end
end


function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end


function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end

end


function getItem()
  return getRandomItem()
end


function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
      resetHistory() 
      print("History has been reset.\n")
      return
  elseif (args == "printAllMainContent") then
      printAllMainContent()
      return
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3820 by @dye in #hi 8 months agoSlack Archive

{lua}

local channelName = "hi"

function getAllMainContent()

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    full,
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?",
    "I heared I can get help with my visa in this channel, is that true?"
  }

  return responses
end

function getMainContent()

  

  local responses = getAllMainContent();

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(responses[1])
  end
end



function printMainContent()
  print(getMainContent())
end


function printAllMainContent()

  local all = getAllMainContent()
  for i=1, #all do
    print(string.format("\n%d---------\n", i))
    print(all[i])
    print(string.format("\n%d---------\n", i))
  end
end


function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end


function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end

end


function getItem()
  return getRandomItem()
end


function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
      resetHistory() 
      print("History has been reset.\n")
      return
  elseif (args == "printAllMainContent") then
      printAllMainContent()
      return
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3819 by @dye in #hi 8 months agoSlack Archive

{lua}

local channelName = "hi"

function getAllMainContent()

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    full,
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?",
    "I heared I can get help with my visa in this channel, is that true?"
  }

  return responses
end

function getMainContent()

  

  local responses = getAllMainContent();

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(responses[1])
  end
end



function printMainContent()
  print(getMainContent())
end


function printAllMainContent()

  local all = getAllMainContent()
  for i=1, #all do
    print(string.format("\n---------%d\n", i))
    print(all[i])
    print(string.format("\n---------%d\n", i))
  end
end


function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end


function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end

end


function getItem()
  return getRandomItem()
end


function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
      resetHistory() 
      print("History has been reset.\n")
      return
  elseif (args == "printAllMainContent") then
      printAllMainContent()
      return
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3818 by @dye in #hi 8 months agoSlack Archive

{lua}

local channelName = "hi"

function getAllMainContent()

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    full,
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?",
    "I heared I can get help with my visa in this channel, is that true?"
  }

  return responses
end

function getMainContent()

  

  local responses = getAllMainContent();

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(responses[1])
  end
end



function printMainContent()
  print(getMainContent())
end


function printAllMainContent()

  local all = getAllMainContent()
  for i=1, #all do
    print(string.format("\n---------%d\n", i))
    print(all[i])
    print('\n---------\n')
  end
end


function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end


function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end

end


function getItem()
  return getRandomItem()
end


function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
      resetHistory() 
      print("History has been reset.\n")
      return
  elseif (args == "printAllMainContent") then
      printAllMainContent()
      return
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3817 by @dye in #hi 8 months agoSlack Archive

{lua}

local channelName = "hi"

function getAllMainContent()

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    full,
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?",
    "I heared I can get help with my visa in this channel, is that true?"
  }

  return responses
end

function getMainContent()

  

  local responses = getAllMainContent();

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(responses[1])
  end
end



function printMainContent()
  print(getMainContent())
end


function printAllMainContent()

  local all = getAllMainContent()
  for i=1, #all do
    print(string.format("\n---------%d\n', i))
    print(all[i])
    print('\n---------\n')
  end
end


function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end


function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end

end


function getItem()
  return getRandomItem()
end


function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
      resetHistory() 
      print("History has been reset.\n")
      return
  elseif (args == "printAllMainContent") then
      printAllMainContent()
      return
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3816 by @dye in #hi 8 months agoSlack Archive

{lua}

local channelName = "hi"

function getAllMainContent()

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    full,
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?",
    "I heared I can get help with my visa in this channel, is that true?"
  }

  return responses
end

function getMainContent()

  

  local responses = getAllMainContent();

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(responses[1])
  end
end



function printMainContent()
  print(getMainContent())
end


function printAllMainContent()

  local all = getAllMainContent()
  for i=1, #all do
    print(all[i])
    print('\n---------\n')
  end
end


function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end


function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end

end


function getItem()
  return getRandomItem()
end


function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
      resetHistory() 
      print("History has been reset.\n")
      return
  elseif (args == "printAllMainContent") then
      printAllMainContent()
      return
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3815 by @dye in #hi 8 months agoSlack Archive

{lua}

local channelName = "hi"

function getAllMainContent()

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    full,
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?",
    "I heared I can get help with my visa in this channel, is that true?"
  }

  return responses
end

function getMainContent()

  

  local responses = getAllMainContent();

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(responses[1])
  end
end



function printMainContent()
  print(getMainContent())
end


function printAllMainContent()

  local all = getAllMainContent()
  for i=1, #all do
    print(all[i])
    print('---------\n')
  end
end


function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end


function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end

end


function getItem()
  return getRandomItem()
end


function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
      resetHistory() 
      print("History has been reset.\n")
      return
  elseif (args == "printAllMainContent") then
      printAllMainContent()
      return
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3814 by @dye in #hi 8 months agoSlack Archive

{lua}

local channelName = "hi"

function getAllMainContent()

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    full,
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?",
    "I heared I can get help with my visa in this channel, is that true?"
  }

  return responses
end

function getMainContent()

  

  local responses = getAllMainContent();

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(responses[1])
  end
end



function printMainContent()
  print(getMainContent())
end


function printAllMainContent()

  local all = getAllMainContent()
  for i=1, #all do
    print(all[i])
    print('\n')
  end
end


function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end


function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end

end


function getItem()
  return getRandomItem()
end


function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
      resetHistory() 
      print("History has been reset.\n")
      return
  elseif (args == "printAllMainContent") then
      printAllMainContent()
      return
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3813 by @dye in #hi 8 months agoSlack Archive

{lua}

local channelName = "hi"

function getAllMainContent()

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    full,
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?",
    "I heared I can get help with my visa in this channel, is that true?"
  }

  return responses
end

function getMainContent()

  

  local responses = getAllMainContent();

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(responses[1])
  end
end



function printMainContent()
  print(getMainContent())
end


function printAllMainContent()

  local all = getAllMainContent()
  for i=1, #all do
    print(all[i])
    print('\n')
  end
end


function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end


function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end

end


function getItem()
  return getRandomItem()
end


function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") 
  then 
      resetHistory() 
      print("History has been reset.\n")
      return
  elseif (args == "printAllMainContent") 
      printAllMainContent()
      return
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3812 by @dye in #hi 8 months agoSlack Archive

{lua}

local channelName = "hi"

function getAllMainContent()

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    full,
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?",
    "I heared I can get help with my visa in this channel, is that true?"
  }

  return responses
end

function getMainContent()

  

  local responses = getAllMainContent();

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(responses[1])
  end
end



function printMainContent()
  print(getMainContent())
end


function printAllMainContent()

  local all = getAllMainContent()
  for i=1, #all do
    print(all[i])
    print('\n')
  end
end


function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end


function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end

end


function getItem()
  return getRandomItem()
end


function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") 
  then 
      resetHistory() 
      print("History has been reset.\n")
      return
  else if (args == "printAllMainContent") 
      printAllMainContent()
      return
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3811 by @dye in #hi 8 months agoSlack Archive

{lua}

local channelName = "hi"

function getAllMainContent()

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    full,
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?",
    "I heared I can get help with my visa in this channel, is that true?"
  }

  return responses
end

function getMainContent()

  

  local responses = getAllMainContent();

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(responses[1])
  end
end



function printMainContent()
  print(getMainContent())
end


function printAllMainContent()

  local all = getAllMainContent()
  for i=1, #all do
    print(all[i])
    print('\n')
  end
end


function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end


function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end

end


function getItem()
  return getRandomItem()
end


function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") 
    then 
      resetHistory() 
      print("History has been reset.\n")
      return
  else if (args == "printAllMainContent") 
    then
      printAllMainContent()
      return
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3810 by @dye in #hi 8 months agoSlack Archive

{lua}

local channelName = "hi"

function getAllMainContent()

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    full,
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?",
    "I heared I can get help with my visa in this channel, is that true?"
  }

  return responses
end

function getMainContent()

  

  local responses = getAllMainContent();

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(responses[1])
  end
end



function printMainContent()
  print(getMainContent())
end


function printAllMainContent()

  local all = getAllMainContent()
  for i=1, #all do
    print(all[i])
    print('\n')
  end
end


function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end


function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end

end


function getItem()
  return getRandomItem()
end


function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
      resetHistory() 
      print("History has been reset.\n")
      return
    else if (args == "printAllMainContent") then
      printAllMainContent()
      return
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3809 by @dye in #hi 8 months agoSlack Archive

{lua}

local channelName = "hi"

function getAllMainContent()

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    full,
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?",
    "I heared I can get help with my visa in this channel, is that true?"
  }

  return responses
end

function getMainContent()

  

  local responses = getAllMainContent();

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(responses[1])
  end
end



function printMainContent()
  print(getMainContent())
end


function printAllMainContent()

  local all = getAllMainContent()
  for i=1, #all do
    print(all[i])
    print('\n')
  end
end


function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end


function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end

end


function getItem()
  return getRandomItem()
end


function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
      resetHistory() 
      print("History has been reset.\n")
      return
    else if (args == "printAllMainContent")
      printAllMainContent()
      return
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3808 by @dye in #hi 8 months agoSlack Archive

{lua}

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    full,
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure in this channel by themselves.\nAre you `born2treasure-hunt`?",
    "I heared I can get help with my visa in this channel, is it true?"
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end
end

function printMainContent()
  print(getMainContent())
end

function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end


function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end

end


function getItem()
  return getRandomItem()
end


function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
    resetHistory() 
    print("History has been reset.\n")
    return 
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3807 by @dye in #[IM @dye] 8 months agoSlack Archive

{lua}

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge is in the *PINNED* files.",
    "There are hidden treasure in this channel; Can *YOU* find them?",
    "Only `0.42%` of the channel visitors discovered the hidden treasure by themselves.\nAre you `born2treasure-hunt`?",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end
end

function printMainContent()
  print(getMainContent())
end

function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end


function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end

end


function getItem()
  return getRandomItem()
end


function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
    resetHistory() 
    print("History has been reset.\n")
    return 
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3806 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end
end

function printMainContent()
  print(getMainContent())
end

function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end


function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end

end


function getItem()
  return getRandomItem()
end


function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
    resetHistory() 
    print("History has been reset.\n")
    return 
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3805 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

local d = fdata
function resetHistory()
  d.history = nil
end

function initHistory(n_total)
  local h = {}
  for i=1, n_total do
    h[i] = false
  end
  d.history = h
  return h
end

function printHistory()
  local h = d.history
  local l = table.getn(h)
  print(l)
  for i=1, l do
    print(h[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end
end

function printMainContent()
  print(getMainContent())
end

function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end


function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end

end


function getItem()
  return getRandomItem()
end


function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
    resetHistory() 
    print("History has been reset.\n")
    return 
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3804 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

local d = fdata
function resetHistory()
  d.history = nil
end

function initHistory(n_total)
  local h = {}
  for i=1, n_total do
    h[i] = false
  end
  d.history = h
  return h
end

function printHistory()
  local h = d.history
  local l = table.getn(h)
  print(l)
  for i=1, l do
    print(h[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end
end

function printMainContent()
  print(getMainContent())
end

function getData()
  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)
  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  return ft, n_ft, nft, n_nft, n_total
end


function getRandomItem()

  local ft, n_ft, nft, n_nft, n_total = getData()

  local i = math.random(1, n_total)
  if (i <= n_ft) then return ft[i] else return nft[i - n_ft] end

end


function getItem()
  return getRandomItem()
end


function printDidYouKnow()
  local item = getItem()
  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))
end

function main()
  if (args == "reset") then 
    resetHistory() 
    print("History has been reset.\n")
    return 
  end
  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()
printHistory(n_total)

Revision: 3803 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

local a=fdata;function resetHistory()a.history=nil end;function initHistory(n_total)local b={}for c=1,n_total do b[c]=false end;a.history=b;return b end;function printHistory()local b=a.history;local d=table.getn(b)print(d)for c=1,d do print(b[c])print("\n")end end;function getMainContent()local e="hi"local f=[[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]local g={"Community Knowledge ","s2","s3","s4","s5",f}local c=math.random(1,table.getn(g))if channel.name==e then return g[c]else return f end end;function printMainContent()print(getMainContent())end;function getData()local h=[[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]local i=[[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]local j=json.load(h)local k=json.load(i)local l=table.getn(j)local m=table.getn(k)local n_total=l+m;return j,l,k,m,n_total end;function getNonReapeatItem()local j,l,k,m,n_total=getData()local b=a.history;if b==nil then b=initHistory(n_total)end;local n,c=math.random(1,n_total)print(string.format("\nfirst i = %d\n",c))if b[c]==true then n=c+1;if n>n_total then n=1 end;while n~=c and b[n]==true do n=n+1;if n>n_total then n=1 end end;if n==c then b=initHistory(n_total)end;c=n end;b[c]=true;print(string.format("actual i = %d\n",c))a.history=b;if c<=l then return j[c]else return k[c-l]end end;function getItem()return getNonReapeatItem()end;function printDidYouKnow()local o=getItem()print(string.format("\n*%s*\n%s\n%s\n",o.title,o.content,o.source))end;function main()if args=="reset"then resetHistory()print("History has been reset.\n")return end;printMainContent()print("\n============\n*Did You Know?*\n============")printDidYouKnow()end;main()printHistory(n_total)

Revision: 3795 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function reset()
  d.h = nil
end

function initData()
  d.h = true
end

function changeData()
  local h = d.h

  print("before changing:\n\t")
  print(h)

  if (h == true) then h = false
  else h = true end

  d.h = h
end



if (args == "reset") then reset() end

if d.h == nil then initData() end

changeData()

Revision: 3794 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function reset()
  d.h = nil
end

function initData()
  d.h = true
end

function changeData()
  local h = d.h

  print("before changing:\n\t")
  print(h)

  h = !h

  d. = h
end



if (args == "reset") then reset() end

if d.h == nil then initData() end

changeData()

Revision: 3789 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local history = fdata.history

function resetHistory()
  history = nil
end


function initHistory(n_total)
  history = {}
  for i=1, n_total do
    history[i] = false
  end
end

function printHistory()
  local l = table.getn(history)
  print(l)
  for i=1, l do
    print(history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (history == nil) then initHistory(n_total) end
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)
  local q = i + 1
  print(string.format("\nfirst i = %d\n", i))


  if (history[i] == true) 
  then

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and history[q] == true) do
        q = q + 1
      end

      if (q == i) then initHistory(n_total) end

      i = q
      
  end

  history[i] = true
  print(string.format("actual i = %d\n", i))



  -- Really Important!!!
  fdata.history = history


  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

printHistory()


Revision: 3788 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local history = fdata.history

function resetHistory()
  history = nil
end


function initHistory(n_total)
  history = {}
  for i=1, n_total do
    history[i] = false
  end
end

function printHistory()
  --local l = table.getn(history)
  local l = #history
  print(l)
  for i=1, l do
    print(history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (history == nil) then initHistory(n_total) end
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)
  local q = i + 1
  print(string.format("\nfirst i = %d\n", i))


  if (history[i] == true) 
  then

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and history[q] == true) do
        q = q + 1
      end

      if (q == i) then initHistory(n_total) end

      i = q
      
  end

  history[i] = true
  print(string.format("actual i = %d\n", i))



  -- Really Important!!!
  fdata.history = history


  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

printHistory()


Revision: 3787 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local history = fdata.history

function resetHistory()
  history = nil
end


function initHistory(n_total)
  history = {}
  for i=1, n_total do
    history[i] = false
  end
end

function printHistory()
  local l = table.getn(history)
  print(l)
  for i=1, l do
    print(history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (history == nil) then initHistory(n_total) end
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)
  local q = i + 1
  print(string.format("\nfirst i = %d\n", i))


  if (history[i] == true) 
  then

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and history[q] == true) do
        q = q + 1
      end

      if (q == i) then initHistory(n_total) end

      i = q
      
  end

  history[i] = true
  print(string.format("actual i = %d\n", i))



  -- Really Important!!!
  fdata.history = history


  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

printHistory()


Revision: 3786 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local history = fdata.history

function resetHistory()
  history = nil
end


function initHistory(n_total)
  history = {}
  for i=1, n_total do
    history[i] = false
  end
end

function printHistory()
  local l = table.getn(history)
  print(l)
  for i=1, l do
    print(history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (history == nil) then initHistory(n_total) end
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)
  local q = i + 1
  print(string.format("first i = %d\n", i))


  if (history[i] == true) 
  then

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and history[q] == true) do
        q = q + 1
      end

      if (q == i) then initHistory(n_total) end

      i = q
      
  end

  history[i] = true
  print(string.format("actual i = %d\n", i))



  -- Really Important!!!
  fdata.history = history


  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

printHistory()


Revision: 3785 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local history = fdata.history

function resetHistory()
  history = nil
end


function initHistory(n_total)
  history = {}
  for i=1, n_total do
    history[i] = false
  end
end

function printHistory()
  local l = table.getn(history)
  print(l)
  for i=1, l do
    print(history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (history == nil) then initHistory(n_total) end
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)
  local q = i + 1
  print(string.format("first i = %d\n", i))


  if (history[i] == true) 
  then

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and history[q] == true) do
        q = q + 1
      end

      if (q == i) then initHistory(n_total) end

      i = q
      
  end

  history[i] = true
  fdata.history = history


  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

printHistory()


Revision: 3784 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  for i=1, n_total do
    d.history[i] = false
  end
end

function printHistory()
  local l = table.getn(d.history)
  print(l)
  for i=1, l do
    print(d.history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)
  local q = i + 1
  print(string.format("first i = %d\n", i))


  if (d.history[i] == true) 
  then

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q] == true) do
        q = q + 1
      end

      if (q == i) then initHistory(n_total) end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

printHistory()


Revision: 3783 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[1] = false

  d.history[n_total] = false
end

function printHistory()
  local l = table.getn(d.history)
  print(l)
  for z=1, l do
    print(d.history[z])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)
  local q = i + 1
  print(string.format("first i = %d\n", i))


  if (d.history[i] == true) 
  then

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q] == true) do
        q = q + 1
      end

      if (q == i) then initHistory(n_total) end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

printHistory()


Revision: 3782 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[1] = false

  d.history[n_total] = false
end

function printHistory()
  local l = table.getn(d.history)
  print(l)
  for z=1, l do
    print(d.history[z])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)
  local q = i + 1
  print("first i = %d\n", i)


  if (d.history[i] == true) 
  then

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q] == true) do
        q = q + 1
      end

      if (q == i) then initHistory(n_total) end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

printHistory()


Revision: 3781 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[1] = false

  d.history[n_total] = false
end

function printHistory()
  local l = table.getn(d.history)
  print(l)
  for z=1, l do
    print(d.history[z])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory(n_total) end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

printHistory()


Revision: 3780 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[1] = false

  d.history[n_total] = false
end

function printHistory()
  local l = table.getn(d.history)
  print(l)
  for z=1, l do
    print(d.history[z])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

printHistory()


Revision: 3779 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[1] = false

  d.history[n_total] = false


  print("\n")
  print(table.getn(d.history))
  print("\n")
  print(n_total)
end

function printHistory()
  local l = table.getn(d.history)
  print(l)
  for z=1, l do
    print(d.history[z])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

printHistory()


Revision: 3778 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[1] = false

  d.history[n_total] = false


  print("\n")
  print(table.getn(d.history))
  print("\n")
  print(n_total)
end

function printHistory()
  local l = #d.history
  print(l)
  for z=1, l do
    print(d.history[z])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

printHistory()


Revision: 3777 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[1] = false

  d.history[n_total] = false


  print("\n")
  print(table.getn(d.history))
  print("\n")
  print(n_total)
end

function printHistory()
  for i=1, #d.history do
    print(d.history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

printHistory()


Revision: 3776 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[1] = false

  d.history[n_total] = false


  print("\n")
  print(table.getn(d.history))
  print("\n")
  print(n_total)
end

function printHistory()
  for i=1, #d.history do
    print(d.history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  printHistory()
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3775 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[1] = false

  d.history[n_total] = false


  print("\n")
  print(table.getn(d.history))
  print("\n")
  print(n_total)
end

function printHistory()
  for i=1, #d.history do
    print(d.history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  print(n_total)
  print("\n")

  if (d.history == nil) then initHistory(n_total) end
  printHistory()
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3774 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[1] = false

  d.history[n_total] = false


  print("\n")
  print(table.getn(d.history))
  print("\n")
  print(n_total)
end

function printHistory()
  for i=1, #d.history do
    print(d.history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  printHistory()
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3773 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[1] = false

  d.history[n_total] = false


  print("\n")
  print(table.getn(d.history))
  print("\n")
  print(n_total)
end

function printHistory()
  for i=1, #d.history do
    print(d.history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  --printHistory()
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3772 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[1] = false

  d.history[n_total] = false


  print("\n")
  --print(table.getn(d.history)
  print("\n")
  print(n_total)
end

function printHistory()
  for i=1, #d.history do
    print(d.history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  --printHistory()
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3771 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[1] = false

  d.history[n_total] = false


  print("\n")
  print(table.getn(d.history)
  print("\n")
  print(n_total)
end

function printHistory()
  for i=1, #d.history do
    print(d.history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  --printHistory()
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3770 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[n_total] = false


  print("\n")
  print(table.getn(d.history)
  print("\n")
  print(n_total)
end

function printHistory()
  for i=1, #d.history do
    print(d.history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  --printHistory()
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3769 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[n_total] = false

  local l = #d.history
  --print(l)
  print("\n")
  print(table.getn(d.history)
  print("\n")
  print(n_total)
end

function printHistory()
  for i=1, #d.history do
    print(d.history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  --printHistory()
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3768 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[n_total] = false

  local l = #d.history
  print(l)
  print("\n")
  print(table.getn(d.history)
  print("\n")
  print(n_total)
end

function printHistory()
  for i=1, #d.history do
    print(d.history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  --printHistory()
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3767 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[d.history] = false

  local l = #d.history
  print(l)
  print("\n")
  print(table.getn(d.history)
  print("\n")
  print(n_total)
end

function printHistory()
  for i=1, #d.history do
    print(d.history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  --printHistory()
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3766 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[d.history] = false
  print(#d.history)
  print("\n")
  print(table.getn(d.history)
  print("\n")
  print(n_total)
end

function printHistory()
  for i=1, #d.history do
    print(d.history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  --printHistory()
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3765 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory(n_total)
  d.history = {}
  d.history[d.history] = false
end

function printHistory()
  print(#d.history)
  for i=1, #d.history do
    print(d.history[i])
    print("\n")
  end 
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft

  if (d.history == nil) then initHistory(n_total) end
  printHistory()
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end





function main()

  if (args == "reset") then resetHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3764 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory()
  d.history = {}
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "nt1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "nt2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "nt3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "nt4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "nt5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "nt6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


function printHistory()
  for i=1, #d.history do
    print(d.history[i])
    print("\n")
  end 
end


function main()

  if (args == "reset") then resetHistory() end

  if (d.history == nil) then initHistory() end
  printHistory()

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3763 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory()
  d.history = {}
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


function printHistory()
  for i=1, #d.history do
    print(d.history[i])
    print("\n")
  end 
end


function main()

  if (args == "reset") then resetHistory() end

  if (d.history == nil) then initHistory() end
  printHistory()

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3762 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory()
  d.history = {}
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


function printHistory()
  for i=1, #d.history do
    print(d.history[i])
    print("\n")
  end 
end


function main()

  if (d.history == nil) then initHistory() end
  printHistory()

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3761 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory()
  d.history = {}
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end



function main()

  if (d.history == nil) then initHistory() end
  print(d.history)

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3760 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory()
  d.history = {}
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) 
  then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      i = q
      
  end

  d.history[i] = true

  if (i <= n_ft) 
  then 
    return ft[i]
  else
    return nft[i - n_ft]
  end
end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end



function main()

  if (d.history == nil) then initHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3759 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory()
  d.history = {}
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      d.history[q] = true

      if (q <= n_ft) then return ft[q] end

      return nft[q - n_ft]

  end



end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end



function main()

  if (d.history == nil) then initHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

main()

Revision: 3758 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory()
  d.history = {}
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      d.history[q] = true

      if (q <= n_ft) then return ft[q] end

      return nft[q - n_ft]

  end



end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end



function main()

  if (d.history == nil) then initHistory() end

  printMainContent()
  print("\n============\n*Did You Know?*\n============")
  printDidYouKnow()
end

Revision: 3757 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory()
  d.history = {}
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q ~= i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      d.history[q] = true

      if (q <= n_ft) then return ft[q] end

      return nft[q - n_ft]

  end



end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printMainContent()
print("\n============\n*Did You Know?*\n============")
printDidYouKnow()

Revision: 3756 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function resetHistory()
  d.history = nil
end


function initHistory()
  d.history = {}
end

function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "Community Knowledge ",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end




function getNonReapeatItem()

  -- 42-related items
  local json_ft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- non-42-related items
  local json_nft = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  -- parse json data to Lua object
  local ft = json.load(json_ft)
  local nft = json.load(json_nft)



  local n_ft = table.getn(ft)
  local n_nft = table.getn(nft)
  local n_total = n_ft + n_nft
  
  -- pick a non-repeated random item

  local i = math.random(1, n_total)


  if (d.history[i] == true) then
      local q = i + 1

      -- reach limit, start from 1
      if (q > n_total) then q = 1 end

      while (q != i and d.history[q]) do
        q = q + 1
      end

      if (q == i) then initHistory() end

      d.history[q] = true

      if (q <= n_ft) then return ft[q] end

      return nft[q - n_ft]

  end



end


function getItem()
  return getNonReapeatItem()
end


function printDidYouKnow()
  
  local item = getItem()

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printMainContent()
print("\n============\n*Did You Know?*\n============")
printDidYouKnow()

Revision: 3755 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

local s = {}
s[1] = true
s[2] = true
s[5] = true



function changeS(i)

if (s[i] == nil) then s[i] = true end

end


function pS()
  for i=1, #s do
    print(s[i])
    print("\n")
  end 
end




function changeAllS()
  for i=1, #s do
    changeS(i)
  end 
end


pS()
changeAllS()
print("\n")
pS()
changeAllS()
print("\n")

Revision: 3754 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

local s = {}
s[1] = true
s[2] = true
s[5] = true



function changeS(i)

if (s[i] == true) then s[i] = false end

end


function pS()
  for i=1, #s do
    print(s[i])
    print("\n")
  end 
end




function changeAllS()
  for i=1, #s do
    changeS(i)
  end 
end


pS()
changeAllS()
print("\n")
pS()
changeAllS()
print("\n")

Revision: 3753 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

local s = {}
s[1] = true
s[2] = true
s[5] = true



function changeS(i)

if (s[i] == true) then s[i] = false end

end


function pS()
  for i=1, #s do
    print(s[i])
    print("\n")
  end 
end




function changeAllS()
  for i=1, #s do
    changeS(i)
  end 
end


pS()
changeAllS()
print("\n")
pS()

Revision: 3752 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

local s = {}
s[1] = true
s[2] = true
s[5] = true



function changeS(i)

if (s[i] == true) then s[i] = false end

end


function pS()
  for i=1, #s do
    print(s[i])
    print("\n")
  end 
end




function changeAllS()
  for i=1, #s do
    changeS(i)
  end 
end


pS()
changeAllS()
pS()

Revision: 3751 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

local s = {}
s[1] = true
s[2] = true


function changeS(i)

if (s[i] == true) then s[i] = false end

end


function pS()
  for i=1, #s do
    print(s[i])
    print("\n")
  end 
end




function changeAllS()
  for i=1, #s do
    changeS(i)
  end 
end


pS()
changeAllS()
pS()

Revision: 3750 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

local s = {}
s[1] = true
s[2] = true


function changeS(i)

if (s[i] == true) then s[i] = false end

end


function pS()
  for i=1, #s do
    print(s[i])
  end 
end




function changeAllS()
  for i=1, #s do
    changeS(i)
  end 
end


pS()
changeAllS()
pS()

Revision: 3749 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

local s = {}
s[1] = true
s[2] = true


function changeS(i)

if (s[i] == true) then s[i] = false end

end


function pS()
  for i=1, #s do
    print(s[i]..'\n')
  end 
end




function changeAllS()
  for i=1, #s do
    changeS(i)
  end 
end


pS()
changeAllS()
pS()

Revision: 3748 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

local s = {}
s[1] = true
s[2] = true


function changeS(i)

if (s[i] == true) then s[i] = false end

end


function pS()
  for i=1, #s do
    print(s[i])
  end 
end




function changeAllS()
  for i=1, #s do
    changeS(i)
  end 
end


pS()
changeAllS()
pS()

Revision: 3747 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

local s = {}
s[1] = true
s[2] = true


function changeS(i)

if (s[i] == true) then s[i] = false end

end


function pS()
  for i, #s do
    print(s[i])
  end 
end




function changeAllS()
  for i, #s do
    changeS(i)
  end 
end


pS()
changeAllS()
pS()

Revision: 3746 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function reset()
  d.history = nil
end

function initData()
  d.history = {11, 12, 13}
end

function changeData()
  local h = d.history

  print("before changing:\n\t")
  print(h[1])

  h[1] = 1 + h[1]

  d.history = h
end



if (args == "reset") then reset() end

if d.history == nil then initData() end

changeData()

Revision: 3745 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function reset()
  d.history = nil
end

function initData()
  d.history = {11, 12, 13}
end

function changeData()
  local h = d.history

  print("before changing:\n\t")
  print(h[1])

  h[1] = 1 + h[1]

  d.history = h
end


-- uncomment the next line to reset
--reset()

if d.history == nil then initData() end

changeData()

Revision: 3744 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function reset()
  d.history = nil
end

function initData()
  d.history = {11, 12, 13}
end

function changeData()
  local h = d.history

  print("before changing:\n\t")
  print(h[1])

  h[1] = 1 + h[1]

  d.history = h
end


-- uncomment the next line to reset
reset()

if d.history == nil then initData() end

changeData()

Revision: 3743 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function reset()
  d.history = nil
end

function initData()
  d.history = {11, 12, 13}
end

function changeData()
  local h = d.history

  print("before changing:\n\t")
  print(h[1])

  h[1] += 1

  d.history = h
end


-- uncomment the next line to reset
reset()

if d.history == nil then initData() end
changeData()

Revision: 3742 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function reset()
  d.history = nil
end

function reload()
  local h = {11, 12, 13}

  d.history = h
end

function pull()
  local h = d.history

  print("before changing:\n\t")
  print(h[1])

  h[1] = 1

  d.history = h
end


--reset()
if d.history == nil then reload() end
pull()

Revision: 3741 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function reset()
  d.history = nil
end

function reload()
  local h = {11, 12, 13}

  d.history = h
end

function pull()
  local h = d.history

  print("before changing:\n\t")
  print(h[1])

  h[1] = 1

  d.history = h
end


reset()
if d.history == nil then reload() end
pull()

Revision: 3740 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function reset()
  d.history = nil
end

function reload()
  local h = {11, 12, 13}

  d.history = h
end

function pull()
  local h = d.history

  print("before changing:\n\t")
  print(h[1])

  h[1] = 1

  d.history = h
end


--reset()
if d.history == nil then reload() end
pull()

Revision: 3739 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function reset()
  d.history = nil
end

function reload()
  local h = {11, 12, 13}

  d.history = h
end

function pull()
  local h = d.history

  print("before changing:\n\t")
  print(h[1])

  h[1] = 1

  d.history = h
end


//reset()
if d.history == nil then reload() end
pull()

Revision: 3738 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function reset()
  d.history = nil
end

function reload()
  local h = {11, 12, 13}

  d.history = h
end

function pull()
  local h = d.history

  print("before changing:\n\t")
  print(h[1])

  h[1] = 1

  d.history = h
end


if d.history == nil then reload() end
pull()

Revision: 3737 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function reset()
  d.history = nil
end

function reload()
  local h = {11, 12, 13}

  d.history = h
end

function pull()
  local h = d.history

  print("before changing:\n\t")
  print(h[1])

  h[1] = 1

  d.history = ch
end


if d.history == nil then reload() end
pull()

Revision: 3736 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function reset()
  d.history = nil
end

function reload()
  local h = {11, 12, 13}

  d.history = h
end

function pull()
  local h = d.history

  print("before changing:\n\t")
  print(h[1])

  h[1] = 1

  d.history = ch
end



reset()
if d.history == nil then reload() end
pull()

Revision: 3735 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function reset()
  d.history = nil
end

function reload()
  d.history = [12, 21, 56]
end

function pull()
  local h = d.history

  print("before changing:\n\t")
  print(h[1])

  h[1] = 1

  d.history = ch
end

if d.history == nil then reload() end


reset()
pull()

Revision: 3734 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function reset()
  d.history = nil
end

function reload()
  d.history = {12, 21, 56}
end

function pull()
  local h = d.history

  print("before changing:\n\t")
  print(h[1])

  h[1] = 1

  d.history = ch
end

if d.history == nil then reload() end


reset()
pull()

Revision: 3733 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


local d = fdata

function reload()
  d.history = {12, 21, 56}
end

function pull()
  local h = d.history

  print("before changing:\n\t")
  print(h)

  h[1] = 1

  d.history = ch
end

if d.history == nil then reload() end

pull()

Revision: 3732 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "s1",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end


function getData()


  local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  return json.load(js)

end


function printDidYouKnow()
  
  local data = getData()
  local i = math.random(1, table.getn(data))
  local item = data[i]

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printMainContent()
print("\n============\n*Did You Know?*\n============")
printDidYouKnow()

Revision: 3731 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "s1",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end


function getData()


  local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  return json.load(js)

end


function printDidYouKnow()
  
  local data = getData()
  local i = math.random(1, table.getn(data))
  local item = data[i]

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printMainContent()
print("\n==============\n*Did You Know ......*\n==============")
printDidYouKnow()

Revision: 3730 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "s1",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end


function getData()


  local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  return json.load(js)

end


function printDidYouKnow()
  
  local data = getData()
  local i = math.random(1, table.getn(data))
  local item = data[i]

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printMainContent()
print("\n=============\n*Did You Know ...*\n=============")
printDidYouKnow()

Revision: 3729 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "s1",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end


function getData()


  local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  return json.load(js)

end


function printDidYouKnow()
  
  local data = getData()
  local i = math.random(1, table.getn(data))
  local item = data[i]

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printMainContent()
print("\n==============\n*Did You Know ...*\n==============")
printDidYouKnow()

Revision: 3728 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "s1",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end


function getData()


  local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  return json.load(js)

end


function printDidYouKnow()
  
  local data = getData()
  local i = math.random(1, table.getn(data))
  local item = data[i]

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printMainContent()
print("\n==============\n*Did You Know ...\n==============")
printDidYouKnow()

Revision: 3727 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "s1",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end


function getData()


  local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

  return json.load(js)

end


function printDidYouKnow()
  
  local data = getData()
  local i = math.random(1, table.getn(data))
  local item = data[i]

  print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printMainContent()
print("\n===========\n*Did You Know ...\n===========")
printDidYouKnow()

Revision: 3726 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


function getMainContent()

  local channelName = "hi"

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  local responses = {
    "s1",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local i = math.random(1, table.getn(responses))

  if (channel.name == channelName)
  then
    return(responses[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end

printMainContent()

Revision: 3725 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


function getMainContent()

  local channelName = "hi"



  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]


  local arr = {
    "s1",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  print(table.getn(arr)..'\n')
  local i = math.random(1, table.getn(arr))

  if (channel.name == channelName)
  then
    return(arr[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end

printMainContent()

Revision: 3724 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


function getMainContent()

  local channelName = "hi"

  local arr = {
    "s1",
    "s2",
    "s3",
    "s4",
    "s5",
    full
  }

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  print(table.getn(arr)..'\n')
  local i = math.random(1, table.getn(arr))

  if (channel.name == channelName)
  then
    return(arr[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end

printMainContent()

Revision: 3723 (deleted) by @dye in #[IM @dye] 8 months agoSlack Archive

{lua}


function getMainContent()

  local channelName = "hi"

  local arr = {
    "s1",
    "s2",
    "s3",
    "s4",
    "s5"
  }

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  print(table.getn(arr)..'\n')
  local i = math.random(1, table.getn(arr))

  if (channel.name == channelName)
  then
    return(arr[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end

printMainContent()

Revision: 3722 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


function getMainContent()

  local arr = {
    "s1",
    "s2",
    "s3",
    "s4",
    "s5"
  }

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  print(table.getn(arr)..'\n')
  local i = math.random(1, table.getn(arr))

  if (channel.name == "hi")
  then
    return(arr[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end

printMainContent()

Revision: 3721 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

printMainContent()

function getMainContent()

  local arr = {
    "s1",
    "s2",
    "s3",
    "s4",
    "s5"
  }

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  print(table.getn(arr)..'\n')
  local i = math.random(1, table.getn(arr))

  if (channel.name == "hi")
  then
    return(arr[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end

Revision: 3720 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}



function getMainContent()

  local arr = {
    "s1",
    "s2",
    "s3",
    "s4",
    "s5"
  }

  local full = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

  print(table.getn(arr)..'\n')
  local i = math.random(1, table.getn(arr))

  if (channel.name == "hi")
  then
    return(arr[i])
  else
    return(full)
  end

end

function printMainContent()

  print(getMainContent())

end

Revision: 3719 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}
print(channel.name..'\n')

	local arr = {
		"1",
		"2",
		"more",
		"M",
		"m"
	}

	print(table.getn(arr)..'\n')
	local i = math.random(1, table.getn(arr))

if (channel.name == "hi")
then
	print(arr[i])
else
	print("Standard")
end

Revision: 3718 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}
print(channel.name..\n)

	local arr = {
		"1",
		"2",
		"more",
		"M",
		"m"
	}

	print(table.getn(arr))
	local i = math.random(1, table.getn(arr))

if (channel.name == "hi")
then
	print(arr[i])
else
	print("Standard")
end

Revision: 3717 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}
print(channel.name)

	local arr = {
		"1",
		"2",
		"more",
		"M",
		"m"
	}

	print(table.getn(arr))
	local i = math.random(1, table.getn(arr))

if (channel.name == "hi")
then
	print(arr[i])
else
	print("Standard")
end

Revision: 3716 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}
print(channel.name)

Revision: 3715 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}
print(channel.Name)

Revision: 3714 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()


	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "Please read the *PINNED* items in \n- <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and \n- <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications \n\nYou need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3713 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()


	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "Please read the *PINNED* items in \n- <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3712 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()


	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "Please read the *PINNED* items in - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3711 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()


	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3710 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()


	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "[[Please read the *PINNED* items in 
- <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
- <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS You need to `Reset Cache` App, but old messages beyond 10k will be lost.]]",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3709 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()


	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "[[Please read the *PINNED* items in 
- <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
- <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.]]",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3708 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()


	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "[[Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications
You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.]]",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3707 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()


	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "[[Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.]]",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3706 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()


	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "\\nPlease read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3705 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()


	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "\nPlease read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3704 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()


	local s1 = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]


	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": s1,
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3703 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3702 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": '
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.
		',
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3701 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": '
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications
You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.
		',
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3700 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": '[[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications\n
You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.
        ]]',
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3699 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": '[[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.
        ]]',
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3698 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "[[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.
        ]]",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3697 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n*%s*\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3696 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)

	print(table.getn(parsed))
	
	local i = math.random(1, table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n%s\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3695 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)

	print(table.getn(parsed))
	
	local i = math.random(table.getn(parsed) + 1)
	local item = parsed[i]

	print(string.format("\n%s\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3694 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      },
      {
        "title": "t4",
        "content": "c4",
        "source": "s4"
      },
      {
        "title": "t5",
        "content": "c5",
        "source": "s5"
      },
      {
        "title": "t6",
        "content": "c6",
        "source": ""
      }
]

]]

	return json.load(js)

end


function printDidYouKnow(parsed)

	print(table.getn(parsed))
	
	local i = math.random(table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n%s\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3693 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      }
]

]]

	return json.load(js)

end

function printDidYouKnow(parsed)

	print(table.getn(parsed))
	
	local i = math.random(table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n%s\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3692 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      }
]

]]

	return json.load(js)

end

function printDidYouKnow(parsed)

	print(table.getn(parsed))
	math.randomseed( os.time() )
	local i = math.random(table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n%s\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3691 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      }
]

]]

	return json.load(js)

end

function printDidYouKnow(parsed)

	print(table.getn(parsed))
	local i = math.random(table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n%s\n%s\n%s\n", item.title, item.content, item.source))
	
	item = parsed[3]

	print(string.format("\n%s\n%s\n%s\n", item.title, item.content, item.source))

end


printDidYouKnow(getData())

Revision: 3690 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      }
]

]]

	return json.load(js)

end

function printDidYouKnow(parsed)

	print(table.getn(parsed))
	local i = math.random(table.getn(parsed))
	local item = parsed[i]

	print(string.format("\n%s\n%s\n%s\n", item.title, item.content, item.source))
end

printDidYouKnow(getData())

Revision: 3689 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      }
]

]]

	return json.load(js)

end

function printDidYouKnow(parsed)

	print(table.getn(parsed))
	local i = math.random(table.getn(parsed))
	local item = parsed[i]

	print(string.format("%s\n%s\n%s\n", item.title, item.content, item.source))
end

printDidYouKnow(getData())

Revision: 3688 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      }
]

]]

	return json.load(js)

end

function printDidYouKnow(parsed)

	
	print(parsed[1].title)
	print('\n')
	
	print(parsed[2].title)
	print('\n')

	print(parsed[3].content)
	print('\n')
end

printDidYouKnow(getData())

Revision: 3687 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      }
]

]]

	return json.load(js)

end

function p(parsed)

	
	print(parsed[1].title)
	print('\n')
	
	print(parsed[2].title)
	print('\n')

	print(parsed[3].content)
	print('\n')
end

p(getData())
p(getData())

Revision: 3686 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      }
]

]]

	return parsed = json.load(js)

end

function p(parsed)

	
	print(parsed[1].title)
	print('\n')
	
	print(parsed[2].title)
	print('\n')

	print(parsed[3].content)
	print('\n')
end

p(getData())
p(getData())

Revision: 3685 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function getData()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      }
]

]]

	return parsed = json.load(js)

end

function p(parsed)

	
	print(parsed[1].title)
	print('\n')
	
	print(parsed[2].title)
	print('\n')

	print(parsed[3].content)
	print('\n')
end

p()
p()

Revision: 3684 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

function p()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      }
]

]]

	local parsed = json.load(js)
	
	print(parsed[1].title)
	print('\n')
	
	print(parsed[2].title)
	print('\n')

	print(parsed[3].content)
	print('\n')
end

p()
p()

Revision: 3683 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


function pMainContent()

	local s = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

   print(s);
end



function p()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      }
]

]]

	local parsed = json.load(js)
	print(parsed[1])
	print(parsed[2])
	print(parsed[3])

end



pMainContent()
p()

Revision: 3682 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


function pMainContent()

	local s = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

   print(s);
end



function p()

	local js = [[
[
      {
        "title": "t1",
        "content": "c1",
        "source": "s1"
      },
      {
        "title": "t2",
        "content": "c2",
        "source": "s2"
      },
      {
        "title": "t3",
        "content": "c3",
        "source": ""
      }
]

]]

	local parsed = json.load(js)
	print(parsed)

end



pMainContent()
p()

Revision: 3681 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


function pMainContent()

	local s = [[
Please read the *PINNED* items in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

   print(s);
end


pMainContent()
pMainContent()

Revision: 3680 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


function pMainContent()

	local s = [[
Please read the *PINNED items* in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost.

]]

   print(s);
end


pMainContent()
pMainContent()

Revision: 3679 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


function pMainContent()

	local s = "Please read the *PINNED items* in 
  - <#C1GSY923Z|visa> for the *Summary of Rough Cases* at the border and 
  - <#C9LDCS2UQ|bifrost> for the *Student Visa* approach with California College of Communications

You need to `Reset Cache` (Settings -> Advanced) in order to load the updated pinned `md` files in the iOS App, but old messages beyond 10k will be lost."

   print(s);
   print('\n')
end


pMainContent()
pMainContent()

Revision: 3678 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


function max(num1, num2)

   if (num1 > num2) then
      result = num1;
   else
      result = num2;
   end

   return result; 
end


print("The maximum of the two numbers is ",max(10,4))
print("The maximum of the two numbers is ",max(5,6))

Revision: 3677 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


print(user)
print("\n")

print(channel)
print("\n")

ptable(slack)
print("\n")

Revision: 3676 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


print(user)
print("\n")

ptable(channel)
print("\n")

ptable(slack)
print("\n")

Revision: 3675 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


ptable(user)
print("\n")

ptable(channel)
print("\n")

ptable(slack)
print("\n")

Revision: 3674 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


ptable(user)
print("\n")

print(channel)
print("\n")

print(slack)
print("\n")

Revision: 3673 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


ptable(argv)
print("\n")

print(args)
print("\n")

Revision: 3672 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}


ptable(argv)
print("\n")

ptable(args)
print("\n")

Revision: 3671 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}




ptable(argv)
print("\n")

Revision: 3670 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

print(string.format("%s\n%s\n%s\n%s\n%s\n", argv, args, user.name, channel, slack))
print("\n")


ptable(argv)
print("\n")


Revision: 3669 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

print(string.format("%s\n%s\n%s\n%s\n%s\n", argv, args, user.name, channel, slack))
print("\n")


ptable(argv)
print("\n")

ptable(args)
print("\n")

ptable(user)
print("\n")

ptable(channel)
print("\n")

ptable(slack)
print("\n")

Revision: 3668 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

print(string.format("%s\n%s\n%s\n%s\n%s\n", argv, args, user.name, channel, slack))
print("\n")


print(argv)
print("\n")

print(args)
print("\n")

print(user.name)
print("\n")

print(channel.users)
print("\n")

print(slack)
print("\n")

Revision: 3667 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

print(string.format("%s\n%s\n%s\n%s\n%s\n", argv, args, user.name, channel, slack))
print("\n")


print(argv)
print("\n")

print(args)
print("\n")

print(user.name)
print("\n")

print(channel)
print("\n")

print(slack)
print("\n")

Revision: 3666 (deleted) by @dye in #hi 8 months agoSlack Archive

{lua}

print(string.format("%s\n%s\n%s\n%s\n%s\n", argv, args, user, channel, slack))
print("\n")


print(argv)
print("\n")

print(args)
print("\n")

print(user)
print("\n")

print(channel)
print("\n")

print(slack)
print("\n")

Revision: 3665 (deleted) by @dye in #[IM @dye] 8 months agoSlack Archive

{lua}

print(string.format("%s\n%s\n%s\n%s\n%s\n", argv, args, user, channel, slack))

print("\n")


print(user)
print("\n")

print(channel)
print("\n")

print(slack)
print("\n")

Revision: 3664 (deleted) by @dye in #[IM @dye] 8 months agoSlack Archive

{lua}

print(string.format("%s\n%s\n%s\n%s\n%s\n", argv, args, user, channel, slack))

print("\n")


print(user)
print("\n")

Revision: 3663 (deleted) by @dye in #[IM @dye] 8 months agoSlack Archive

{lua}

print(string.format("%s\n%s\n%s\n%s\n%s\n", argv, args, user, channel, slack))

Revision: 3662 (deleted) by @dye in #[IM @dye] 8 months agoSlack Archive

{lua}

print(argv)
print(args)

print(user)
print(channel)
print(slack)

Revision: 3661 (deleted) by @dye in #[IM @dye] 8 months agoSlack Archive

{lua}

local example_dataname = "technology/computer_sciences"

ptable(corpus.info[example_dataname])
-- field: "computer_sciences"
-- description: "names of technologies related to computer science"
-- source: ""
-- length: 197

print(corpus[example_dataname][2])

Revision: 3660 (deleted) by @dye in #[IM @dye] 8 months agoSlack Archive

{lua}

local test_content = "123456789"
local paste_url = bot.paste(test_content)
local resp, err = requests.get(paste_url)
print(test_content == resp:text())

Revision: 3659 (deleted) by @dye in #[IM @dye] 8 months agoSlack Archive

{lua}

s = "https://www.42.us.org/"
s1 = "https://www.youtube.com/watch?v=9m_K2Yg7wGQ"

print(string.format("%s\n%s\n", s, s1))

Revision: 3658 (deleted) by @dye in #[IM @dye] 8 months agoSlack Archive

{lua}

s = "Good Text"
s1 = "New text"

print(string.format("%s\n%s\n", s, s1))

Revision: 3657 (deleted) by @dye in #[IM @dye] 8 months agoSlack Archive

{lua}

d = 5; m = 11; y = 1990
print(string.format("%02d/%02d/%04d", d, m, y))

Revision: 3656 (deleted) by @dye in #[IM @dye] 8 months agoSlack Archive

{lua}


print(string.format("pi = %.4f", 3.14456653))

Revision: 3655 (deleted) by @dye in #[IM @dye] 8 months agoSlack Archive

{lua}


print(string.format("pi = %.4f", PI))

Revision: 3654 (deleted) by @dye in #[IM @dye] 8 months agoSlack Archive

{lua}

print(string.char(97))                    
i = 99; print(string.char(i, i+1, i+2))
print(string.format("pi = %.4f", PI))
d = 5; m = 11; y = 1990
print(string.format("%02d/%02d/%04d", d, m, y))

Revision: 3653 (deleted) by @dye in #[IM @dye] 8 months agoSlack Archive

{lua}

print(string.char(97))                    
i = 99; print(string.char(i, i+1, i+2))