Posting code blocks.
I keep forgetting to not use quotes and to use pre-formatted text when posting code blocks. If the code you post doesn’t look right this is probably what’s wrong. Paste the text first, select it, then apply the Preformatted text option from the menu.
But want to know something even better?
Blockquote
function on_message(self, message_id, message, sender)
if message_id == hash(“start_level”) then
– some script tells us to start loading the level
msg.post("#proxy", “async_load”)
– store sender for later notification
self.loader = sender
elseif message_id == hash(“proxy_loaded”) then
– enable the collection and let the loader know
msg.post(sender, “enable”)
msg.post(self.loader, message_id)
end
end
Preformatted text / Codeblock
function on_message(self, message_id, message, sender)
if message_id == hash("start_level") then
-- some script tells us to start loading the level
msg.post("#proxy", "async_load")
-- store sender for later notification
self.loader = sender
elseif message_id == hash("proxy_loaded") then
-- enable the collection and let the loader know
msg.post(sender, "enable")
msg.post(self.loader, message_id)
end
end
But want to know something even better? You can turn on a bit of syntax highlighting too and have nice code blocks without needing to indent. Here is how:
```lua
function on_message(self, message_id, message, sender)
```
function on_message(self, message_id, message, sender)
if message_id == hash("start_level") then
-- some script tells us to start loading the level
msg.post("#proxy", "async_load")
-- store sender for later notification
self.loader = sender
elseif message_id == hash("proxy_loaded") then
-- enable the collection and let the loader know
msg.post(sender, "enable")
msg.post(self.loader, message_id)
end
end