Page 1 of 1

use of varibles

Posted: 28 Aug 2015, 10:26
by timmee2222
Hi
I am looking at using the num lck key on an external key pad as a modifier (effectively doubling the number of keys). is it possible to set a variable in luaMaros?

Re: use of varibles

Posted: 28 Aug 2015, 10:55
by timmee2222
I should really look before I leap - found it in test.lua.
fyi here is my test code...

Code: Select all

clear();
lmc_device_set_name('keyPad', '123F1D63')
--lmc.minimizeToTray = true
numLoc = true

slash = function()
  if(numLoc) then
   lmc_send_keys('It rocks!')
  else
   lmc_send_keys('It rolls!')
  end
end

numLock = function()
 if (numLoc) then
  numLoc = false
 else
  numLoc = true
 end

 if(numLoc) then
  print('numLock is on')
 else
  print('numLock is off')
 end


end

lmc_set_handler('keyPad',111,0,slash)
lmc_set_handler('keyPad',144,0,numLock)