Pre-hashing your hashes.
If you are using hashes often in many places you can optimize some by pre-hashing once, rather than to run hash() on strings over and over as your scripts run. Doing this is easy, and a good practice - at least I assume so!
– Pre-hashing input message hashes
local move_up_hash = hash(“move_up”)
local move_down_hash = hash(“move_down”)
local move_left_hash = hash(“move_left”)
local move_right_hash = hash(“move_right”)function on_message(self, message_id, message, sender)
if message_id == move_up_hash then ... end
end