Last edit: @jkrause in #[IM @jkrause] 10 months ago - Slack Archive

{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
function compare(a,b)
  return a.begin_at < b.begin_at
end
table.sort(j, compare)
local date = ""
for i, item in ipairs(j) do
-- Changed from 3 to 4 to allow for the new Cafe entry on Fridays
 if i > 4 then print("\nMore data available at https://cantina.42.us.org/") return end
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n\n*" .. date .. "*\n")
 end
 item.menu:gsub("\r", "")
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " - " .. string.sub(item.end_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end

History

Revision: 3132 by @jkrause in #[IM @jkrause] 10 months agoSlack Archive

{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
function compare(a,b)
  return a.begin_at < b.begin_at
end
table.sort(j, compare)
local date = ""
for i, item in ipairs(j) do
-- Changed from 3 to 4 to allow for the new Cafe entry on Fridays
 if i > 4 then print("\nMore data available at https://cantina.42.us.org/") return end
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n\n*" .. date .. "*\n")
 end
 item.menu:gsub("\r", "")
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " - " .. string.sub(item.end_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end

Revision: 1010 by @crenfrow in #marvin-dev 2 years agoSlack Archive

{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
function compare(a,b)
  return a.begin_at < b.begin_at
end
table.sort(j, compare)
local date = ""
for i, item in ipairs(j) do
-- Changed from 3 to 4 to allow for the new Cafe entry on Fridays
 if i > 4 then print("\nMore data available at https://cantina.42.us.org/") return end
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n\n*" .. date .. "*\n")
 end
 item.menu:gsub("\r", "")
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
function compare(a,b)
  return a.begin_at < b.begin_at
end
table.sort(j, compare)
local date = ""
for i, item in ipairs(j) do
 if i > 3 then print("\nMore data available at https://cantina.42.us.org/") return end
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n\n*" .. date .. "*\n")
 end
 item.menu:gsub("\r", "")
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()

local date = ""
for i, item in ipairs(j) do
 if i > 3 then print("\nMore data available at https://cantina.42.us.org/") return end
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n\n*" .. date .. "*\n")
 end
 item.menu:gsub("\r", "")
 print(time(item.begin_at))
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
function compare(a,b)
  return time(a) < time(b)
end
table.sort(j, compare)
local date = ""
for i, item in ipairs(j) do
 if i > 3 then print("\nMore data available at https://cantina.42.us.org/") return end
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n\n*" .. date .. "*\n")
 end
 item.menu:gsub("\r", "")
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
function compare(a,b)
	print(a)
  return a < b
end
table.sort(j, compare)
local date = ""
for i, item in ipairs(j) do
 if i > 3 then print("\nMore data available at https://cantina.42.us.org/") return end
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n\n*" .. date .. "*\n")
 end
 item.menu:gsub("\r", "")
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
function compare(a,b)
	print(a)
  return a < b
end
table.sort(j, compare)
local date = ""
for i, item in ipairs(j) do
 if i > 3 then print("\nMore data available at https://cantina.42.us.org/") return end
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n\n*" .. date .. "*\n")
 end
 item.menu:gsub("\r", "")
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
function compare(a,b)
  return a < b
end
table.sort(j, compare)
local date = ""
for i, item in ipairs(j) do
 if i > 3 then print("\nMore data available at https://cantina.42.us.org/") return end
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n\n*" .. date .. "*\n")
 end
 item.menu:gsub("\r", "")
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end

Revision: 512 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 if i > 3 then print("\nMore data available at https://cantina.42.us.org/") return end
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n\n*" .. date .. "*\n")
 end
 item.menu:gsub("\r", "")
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n\n*" .. date .. "*\n")
 end
 item.menu:gsub("\r", "")
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n\n*" .. date .. "*\n")
 end
 item.menu:gsub("\r", "", 10)
 item.menu:gsub("\n\n", "\n")
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n\n*" .. date .. "*\n")
 end
 item.menu:gsub("\r", "")
 item.menu:gsub("\n\n", "\n")
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n\n*" .. date .. "*\n")
 end
 item.menu:gsub("\r", "")
 item.menu:gsub("\n\n", "")
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n\n*" .. date .. "*\n")
 end
 item.menu:gsub("\r", "")
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n## " .. date .. "\n")
 end
 item.menu:gsub("\r", "")
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n##" .. date .. "\n")
 end
 item.menu:gsub("\r", "")
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n*" .. date .. "*\n")
 end
 item.menu:gsub("\r", "")
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n*" .. date .. "*\n")
 end
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu:gsub("\n", ">") .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n*" .. date .. "*\n")
 end
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n" .. item.menu:gsub("\n", "\n>") .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n*" .. date .. "*\n")
 end
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n" .. item.menu:gsub("\n", ">\n") .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n*" .. date .. "*\n")
 end
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n*" .. date .. "*\n")
 end
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>>>" .. item.menu .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n*" .. date .. "*\n")
 end
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>>>" .. item.menu .. "\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n*" .. date .. "*\n")
 end
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu .. "\n\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n*" .. date .. "*\n")
 end
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n>" .. item.menu .. "\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n*" .. date .. "*\n")
 end
 print("@" ..  string.sub(item.begin_at, 12, 16) .. " ~  _$" .. item.price .. ":_\n" .. item.menu .. "\n")
end
{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
local date = ""
for i, item in ipairs(j) do
 local newdate = string.sub(item.begin_at, 1, 10)
 if date ~= newdate then
   date = newdate
   print("\n*" .. date .. "*\n")
 end
 print("_@" ..  string.sub(item.begin_at, 11, 16) .. "_ ~  _$" .. item.price .. ":_ " .. item.menu .. "\n")
end

Revision: 368 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
for i, item in ipairs(j) do
  local date = string.sub(item.begin_at, 1, 10)
  print(date .. ": $" .. item.price .." ".. item.menu .. "\n")
end

Revision: 367 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
for i, item in ipairs(j) do
  local date = string.sub(item.begin_at, 1, 10)
  print(date .. ": " .. item.menu .. "\n")
end

Revision: 366 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} local resp, err = requests.get("https://cantina.42.us.org/marvins_meals")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
print(json.dump(j))