Skip to content

Instantly share code, notes, and snippets.

@fischgeek
Created October 1, 2018 15:03
Show Gist options
  • Save fischgeek/79043d347f5891a5d9d1bbe95372393d to your computer and use it in GitHub Desktop.
Save fischgeek/79043d347f5891a5d9d1bbe95372393d to your computer and use it in GitHub Desktop.
devices={"Lefty","Logi","Rolly"}
lmc_assign_keyboard('Lefty');
lmc_assign_keyboard('Logi');
lmc_assign_keyboard('Rolly');
-- Do not edit below this line
-- --------------------------------------------------
clear();
require "functions"
getmetatable("").__mod = function(a, b)
if not b then
return a
elseif type(b) == "table" then
return string.format(a, unpack(b))
else
return string.format(a, b)
end
end
print("%s becomes %s" % {"x","y"})
lmc_print_devices()
RegisterForObservation_Index=0
RegisterForObservation_FullList={}
function RegisterForObservation(id)
RegisterForObservation_Index=RegisterForObservation_Index+1
lmc_device_set_name(id,id)
print("Registering " .. id)
lmc_set_handler(id, function(button, direction)
if direction==0 then
table.insert(RegisterForObservation_FullList,"print(lmc_device_set_name('%s','%s'))" % {CurrentDevice,id})
CurrentDevice=table.remove(devices,1)
if CurrentDevice==nil then
for k,v in pairs(RegisterForObservation_FullList) do
print(v)
end
else
print("Press " .. CurrentDevice)
end
end
end)
end
print("------------------------------------------------------")
lmc_print_devices();
Tops_Keys = {};
Joy3Down=false
Joy4Down=false
lastKey="";
keystates={}
lastKeys=""
ignoreUp=false
skipKeys=Set({16 ,17,18,91,93})
setbuildUp(false)
for k,v in pairs(devices) do
keystates[v]={}
end
lastKey="";
for key, value in pairs(devices) do
print("Wiring up %s" % {value})
lmc_set_handler(value, function(button, direction)
handleIt(button,direction,value)
end)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment