Defold には強力なメッセージパッシングの機能がありますが、インスタンスの url を都度どこかに保持することが面倒だなと感じたので、少しラップしたアセットを作成してみました。
ライブラリの取り込み
https://github.com/stepism/defold-mira-subscription/archive/master.zip依存するライブラリ
なし。
使い方
購読側
local subscription = require("miraSubscription.subscription") 
 
function init(self)
	self.subscribe_id = subscription.subscribe(".", msg.url())	
end
 
function final(self)
	subscription.remove(".", self.subscribe_id)
end
 
function on_message(self, message_id, message, sender)
	if message_id == hash("setup") then
		print(message.text)
	end
end通知する側
local subscription = require("miraSubscription.subscription")
 
function init(self)
	subscription.notify(".", hash("setup"), {text = "hello"}) 
end