You ONLY want to check for 'mouse_click' events, correct?
So leave out the
if event == "key" then
err = 1
and change it to
if event == "mouse_click" then
--# Existing code here
That's the thing, though - that's what my code
used to be, but it would crash every time a key was pressed. You can see this by running my older v0.2a build:
http://pastebin.com/cEgrT1Qs - when you open a menu and press a button, it throws the program off its loop.
Now, by implementing the dead end "
if event == "key" then" part of the code, the mentality is that it throws all key presses to the side and makes them do nothing. Now when keys are pressed, they just set the dead end variable, 'err' (for now, till I implement click
and key press interactions).
If, in the future, you'd like to integrate keybindings, just add an
elseif event == "key" then
after the if-statement for the mouse_click event.
(or back where it is now. Doesn't really matter)
Gotcha :)/>/>/>
if event == "key" then
err=1
to simply create a non-used variable when the if statement is called.
(On a side-note, what would be used to make it so if an if statement were true, it did nothing at all?)
If you never use that variable, it is still useless
Its not like it will ERROR necessarily, since that's a completely valid thing to do in Lua, it just wastes memory
Since its a single variable its a tiny amount of memory, though its not good practice in the long run :)/>
Oh, yeah, no I didn't think it'd ERROR, but just figured I'd make that the variable representing any non-allowed actions. :P/>
And yeah, I really don't like leaving un-used variables… is there anything I could do that would simply make the if statement "
if event == "key" then" do nothing
at all? I'm considering simply making the code just set the cursor pos to (1,1). In fact, I'll go ahead and edit my code. Tomorrow I'll tidy it up a bit more, but I'm on mobile and need sleep. :)/>
Thanks for the response :D/>