Toggle var in LUA

Some thing to remeber… the clean way is ZOOM_STATE = not ZOOM_STATE

1
2
3
4
5
local ZOOM_STATE = true
 
ZOOM_STATE = (ZOOM_STATE ~= ZOOM_STATE)  -- the same of not ZOOM_STATE
ZOOM_STATE = not ZOOM_STATE; print(ZOOM_STATE)
ZOOM_STATE = not ZOOM_STATE; print(ZOOM_STATE)
This entry was posted in Programming. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">