Reading mojo decls…

About Monkey 2 Forums Monkey 2 Programming Help Reading mojo decls…

This topic contains 7 replies, has 3 voices, and was last updated by  DruggedBunny 1 year, 8 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #9721

    DruggedBunny
    Participant

    I was hoping to grab the list of consts from the Color type to apply randomly to a bunch of cubes! The reflection docs say you can only use this on user-defined types, but I’m assuming the mojo types would fall under this too…

    The bananas example seems to be able to get a list of ALL types and their decls (including consts, I notice), but I can’t figure out how to just list the decls of one specific type…

    The aim being to strip out these and stick in a stack/list/array…

    Any assistance greatly appreciated and all that!

    (This was with latest dev branch yesterday.)

    #9722

    nerobot
    Participant

    From Limitations section in blog:

    You can still use other types (structs etc) with variants etc, but you wont be able to inspect their members.

     

    Print TypeInfo.GetType (“Color”)

    For type-by-name you should to specify full namespace, like std.graphics.Color.

    #9723

    DruggedBunny
    Participant

    Nah, I’ve tried that:

    This results in “Caught signal:Memory access violation”.

    #9727

    nerobot
    Participant

    Mark said improving reflection is one of near goal. 🙂

    #9728

    DruggedBunny
    Participant

    Yeah, I did read that, so will just wait, was just amusing myself anyway… at least it sounds like I was using it properly!

    #9730

    Mark Sibly
    Keymaster

    Weird, will look into it.

    #9782

    Mark Sibly
    Keymaster

    Ok, the main issue here is that Color is a struct, and structs aren’t currently reflected (hence the error ‘not a class or interface’).

    This wasn’t an issue in bmx of course because it didn’t have structs, but I am yet to get them working properly with reflection in monkey2. I do plan to spend more time on reflection soon though and will be looking into this.

    #9788

    DruggedBunny
    Participant

    Ahh, cool… thanks, Mark.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.