Skip to content

Instantly share code, notes, and snippets.

@trentgill
Created February 4, 2021 00:19
Show Gist options
  • Save trentgill/1b83d8bb71a88b39c2146fffe46806b1 to your computer and use it in GitHub Desktop.
Save trentgill/1b83d8bb71a88b39c2146fffe46806b1 to your computer and use it in GitHub Desktop.
demonstrating crow.loadscript
--- crowy: this script runs on crow
function init()
print '~crowy~'
metro[1].event = function(v) print("tick: "..v) end
metro[1]:start()
end
--- upload
-- takes a lua file as argument and sends it to crow
-- can save to crow's internal flash with the optional 'flash' arg
function init()
crow.loadscript(script_dir().."crowy.lua")
end
-- get location of this script
function script_dir()
local path = debug.getinfo(2, "S").source:sub(2):reverse()
local name = path:find("/")
return path:sub(name):reverse()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment