-- Title: Cloud Shadow Toggle Shift+X function togglecloudshadows() local enabled = celestia:getrenderflags().cloudshadows local s if enabled then s = "off" else s = "on" end celestia:flash("Cloud shadows: " .. s) local t = {} t.cloudshadows = not enabled celestia:setrenderflags(t) end -- The table mapping key names to handlers keyhandlers = { X = togglecloudshadows, } function handlekey(k) -- k is a table containing the event properties; in this simple sample, -- we're only interested in char, the name of the key that was pressed. handler = keyhandlers[k.char] if (handler ~= nil) then handler() return true else return false end end celestia:registereventhandler("key", handlekey)