lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> I guess I do not understand what you mean by your above comments, sorry. :(

Bad code:

  if x == 43 then ...
  elseif x == 67 then ...
  ...
  end


Good code:

  -- This is somewhere in your code (probably near the top)
  -- Code for Events
  MOUSECLICK = 43
  KEYPRESS = 67
  ...

  -- this is somewhere else
  if x == MOUSECLICK then ...
  elseif x == KEYPRESS then ...
  ...
  end

(If everything is in the same module, you can declare those names as
locals.)

-- Roberto