Because your wrapper function does not do any extra work, I would suggest just using msg.post().
In my game, if I need to do a bunch of calculations or do stuff before I post a message, I throw a lot of that into a function, but still call the raw msg.post(). It really just depends on what your use case is.
I don’t know if there is a performance benefit, but I personally am going to be moving all of my message strings/hashes to a Lua module to use as a constants file. When I store them, I am going to be using pre-hashed strings because everytime you interact with the Defold engine, it gives you back the hashed versions, so I might as well both send and receive hashed strings to keep consistency.
Yes, it’s better to pre-hash your strings instead of hashing them every frame. You can define them at the top of your file like
local action_touch = hash("touch")
Or do like @gamzwithjamz is doing and put them into a module.
You can use something like this to make get/set automatic. It calculates the hash the first time you request it then reuses that hash every time you call it after.
It would make the most sense for values that are used often, perhaps every frame, such as action ids for input or collision messages. Values used less frequently wouldn’t be as important to hash.