I need runtime reflection

Gheorghe Gabriel knoppy273 at live.com
Fri Sep 29 11:05:00 UTC 2017


On Friday, 29 September 2017 at 09:34:26 UTC, JN wrote:
> On Wednesday, 27 September 2017 at 20:03:27 UTC, Gheorghe 
> Gabriel wrote:
>> Hi,
>>
>> I have a 3D scene editor.
>> I need my scripts to be dynamically loaded in the scene.
>> In c# or java I can use reflections to do that.
>> How can I do that with D?
>> I know that std.traits only works in compile time.
>> Please, help me
>>
>> Gabriel
>
> Your best bet is to either use a scripting language like Lua 
> (Unity is written in C++ and uses C#), or compile your scripts 
> to a dll and load them from there.

Thank you for your answer,

This is a script example:

----------------------------
module game.player;

import engine;

class Player : Actor {

     this(string name) {
         super(name)
     }

     ~this() {}

     void jump() { ... }

     @Editable("Slider")("min = 0; max = 5;")
     ubyte lives = 5;
}
----------------------------

If i compile this script to a .dll then pleyer object can be 
dragged and dropped into the scene?
Do yout think that after the final LDC Android build, the game 
will work properly on Android? (because of .dll scripts)

Gabriel


More information about the Digitalmars-d mailing list