Pigeon - easy and safe message system for Defold

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ก.พ. 2025

ความคิดเห็น • 7

  • @yosefkukuriku
    @yosefkukuriku 11 หลายเดือนก่อน +1

    Looks great!

  • @yosefkukuriku
    @yosefkukuriku 9 หลายเดือนก่อน

    I gotta tell you I just implemented this and its great, thank you so much!

  • @Fate-of-the-Galaxy
    @Fate-of-the-Galaxy ปีที่แล้ว +1

    This looks awesome, looking forward to putting some time aside to try it out!

  • @shaunmax8165
    @shaunmax8165 ปีที่แล้ว +2

    Could you please show a simple example of how to use pigeon over the default messaging system.

    • @unfolding_gamedev
      @unfolding_gamedev  ปีที่แล้ว +4

      Beside of documentation there is an example script: github.com/paweljarosz/pigeon/blob/main/main/example.script
      The default msg.post() calls you have in your script, could be just replaced with pigeon.send_to(), or you can utilise the subscription system and use pigeon.send() instead, but you will need to call in every recipent you wish to pigeon.subscribe() in their init() function ;)
      If you want to check the data, you need to define them with pigeon.define()

  • @ajitbhattarai3809
    @ajitbhattarai3809 ปีที่แล้ว +1

    Can we send class/subclass? As we cannot pass function through message.

    • @unfolding_gamedev
      @unfolding_gamedev  ปีที่แล้ว +1

      Hmm, Lua doesn't uses classes per se, but there are some OOP libraries, if you are thinking about something like this. And yes, you can't pass a function in a message - but you can tell the other script which function to call using a simple table with functions you can call, put it in a module and require it in both scripts (quick and dirty example):
      module.lua
      local M = {}
      M["test1"] = function() print("test1") end
      M["test2"] = function() print("test2") end
      return M
      test1.script in init():
      msg.post("test2", "call_fun", "test1")
      test2.script requires module:
      local my_module = require "module"
      and in on_message():
      if message_id == hash("call_fun") then
      my_module[message]()
      end