Sign in

    moos-sdk

    Download zip
    Author
    Version
    0.1.8
    License
    Apache-2.0
    Last updated
    last year
    Downloads
    210

    #moos-sdk

    runs_on License: GPL v3

    A sdk to build moss extensions easily with moonbit

    #Getting Started

    1. Create a new project with moon new
    2. Add moos as dependency moon add furesoft/moos-sdk
    3. Create those functions
    pub fn moss_extension_register() -> Int {
    let extensionInfo: @moss.ExtensionInfo = {
    files: []
    }

    @host.output_json_value(extensionInfo.to_json())
    0
    }

    pub fn moss_extension_loop() -> Int {
    0
    }

    pub fn moss_extension_unregister() -> Int {
    0
    }
    1. import the moos-sdk and export those functions in the moon.pkg.json
    { "import": [ "gmlewis/moonbit-pdk/pdk", "gmlewis/moonbit-pdk/pdk/host", {"path": "furesoft/moos-sdk/lib", "alias": "moss"} ], "link": { "wasm": { "exports": [ "moss_extension_register", "moss_extension_unregister", "moss_extension_loop" ], "export-memory-name": "memory" } } }
    1. Build it with moon build --target wasm

    Allocate

    pub(open) trait Allocate {
    allocate(Self) -> Int64
    }

    impl Allocate for String

    ConfigGet

    pub struct ConfigGet[T] {
    value : T
    }

    impl Default for ConfigGet[T]
    impl Show for ConfigGet[T]
    impl ToJson for ConfigGet[T]

    allocate

    fn allocate[T : ToJson](obj : T) -> Int64

    config_get

    fn config_get[T :
    FromJson
    ](key : String) -> ConfigGet[T]?

    config_set

    fn config_set[T : ToJson](key : String, value : T) -> Unit

    defaults_get_color

    fn defaults_get_color(key : String) ->
    Color
    ?

    defaults_set_color

    fn defaults_set_color(key : String, color :
    Color
    ) -> Unit

    deserialize

    fn deserialize[T :
    FromJson
    ](ptr : Int64) -> T?

    export_statistical_data

    fn export_statistical_data() -> Unit

    send

    fn send[T : ToJson](data : T) -> Unit

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io