mastodon-unfurl.love/0012-on.initialize

30 lines
831 B
Plaintext

on.initialize = function(arg)
if Major_version >= 12 then
-- LÖVE has https
-- commandline arg is a url
if #arg > 0 then
Url = arg[1]
load_nodes_from_url()
set_cursor(ml_from_url(Url).id)
A()
ensure_cursor_node_within_viewport()
end
else
-- LÖVE pre-v12 doesn't have https
-- we depend on an external shim to download
-- commandline arg is a filename
if #arg == 0 then
-- no ability to load new URL
error('When running with LÖVE v11, please pass in a file containing a Mastodon thread, and optionally an id within it to start out focused on.\n\nThis app currently needs to be invoked from a terminal.')
end
Input_filename = arg[1]
load_nodes_from_input_file()
Cursor_node = Root
if #arg >= 2 then
set_cursor(arg[2])
end
A()
ensure_cursor_node_within_viewport()
end
end