About advanced features I'm curious if Fuze supports?



  • Fuze is great and I'm in love with it, but it noticeably comes with some limitations I'm sure you stumbled into, so I'm curious about some stuff whether you can do officially or by workarounds

    I'm new here, so sorry if some of this stuff was already discussed somewhere here :)

    First one is about structure, it's great that I can do something like

    my_struct = [ .a = 1,
                          .b = 2]
    
    print(my_struct.a)
    

    But I was wondering whether it's possible to access a struct's value dynamically, something like:

    function something(attribute_name)
        value = my_struct[attribute_name]
    return value
    

    Another thing is about libraries, from what I gathered Fuze works with a single file which greatly simplifies thing and makes it easier for someone to read someone else's code without having to search things in a file hierarchy

    It'd be great though to have code that is going to be common in your projects (like controller handling, for example) to be available to your other projects. Is there someway to do that? Or to just copy a part of your code from one project to another?

    Last thing that comes to mind, it'd be great if there was a way to be able to be able to write code in my computer and upload it to the Switch. I'm guessing Fuze does not allow that because I'm sure Nintendo would be concerned because hacking, but just in case, do you guys code everything on the Switch itself?


  • F

    I dunno about the first one, but yes, it is possible to copy&paste code between projects. I don’t know how big the clipboard is exactly, but it is pretty big.

    There’s no transfer between other devices and switch. You have to do it all on switch.


  • Fuze Team

    The Switch is a closed platform so as @toxibunny says, there is no way to import from PC at the present time. Never say never and all that, but that's certainly the way it is at the moment.

    Also there are no plans that I'm aware of to add multiple files per project or shared libraries but there's nothing stopping you from having a project full of library functions and copy / pasting them into other projects. I imagine it's probably just as easy to copy one of your existing projects to a new project and then delete everything you don't need when starting a new project though. That's another option.

    Finally, I'm also not aware of a way of doing what you want with structs. Maybe the example is over-simplified but in the example you give you can do the same thing by simply passing in the value of the struct member. In the next version you can even explicitly choose whether you want to do that by value or reference.



  • @RodrigoDavy said in About advanced features I'm curious if Fuze supports?:

    function something(attribute_name)
        value = my_struct[attribute_name]
    return value
    

    To my knowledge (as a fellow Fuze user), there is no native support for dictionaries / mutators in Fuze.

    A solution that has been used for file storage, is to maintain an array of key/value pairs, and for read/write actions you find the value for the matching key dynamically. Of course that solution is not scalable, but I think that's the best available in Fuze so far...

    edit: a link to a similar question asked earlier: https://fuzearena.com/forum/topic/1058/are-tuples-list-and-dictonaries-in-fuze


  • F

    @RodrigoDavy said in About advanced features I'm curious if Fuze supports?:

    But I was wondering whether it's possible to access a struct's value dynamically, something like:

    function something(attribute_name)
        value = my_struct[attribute_name]
    return value
    

    While there may not be a way to do this with a struct, this may be a good way to use the variable type arrays of Fuze. Each array element can have a different type from the others, and array elements can be referenced by their index. You can also make a struct of constants (like an enum) to give each array index a name. Ex:

    var ele_name = [ .a = 0, .b = 1 ]
    
    var my_array = [ 1, {2, 1} ]
    
    function something(attribute_index)
        value = my_array[attribute_index]
    return value
    
    loop
        clear()
        print(something(ele_name.b))
        update()
    repeat
    


  • Thanks you all for the answers, it cleared up things for me! :D


Log in to reply