These are chat archives for ChaiScript/ChaiScript

5th
Apr 2015
Victor Lopez
@VictorJL
Apr 05 2015 15:44
Actually, it's a good feature. Everything runs smoothly, this was the latest script I made https://gist.github.com/VictorJL/531728a4de5a6b0305dd
There is no performance drop.
There is a bug in the scripting system but I'm not really sure if it is really a bug.
Victor Lopez
@VictorJL
Apr 05 2015 15:49
  sega_logo.construct(fun[sega_logo](){
        sega_logo.add_model("sega_logo",
                        vec3(0.0f, 0.0f, 0.0f),
                        vec3(-100.0f * 640.0f/320.0f, -100.0f*480.0f/224.0f, 0.0f),
                        "sega_logo.json")
    }, fun[sega_logo](){

    }, fun[sega_logo](delta){

    })

These assign to init, deinit and logic, respectively, but if I call immediately init, deinit or logic, sega_logo.init(), it doesn't work. It says no error, they simply don't run. I need to wait until the outer object calls them later in

title.load_actor("sega_logo")

Which, internally does actor.init()

init, deinit, and logic are std::function<void()>, std::function<void()> and std::function<void(const float&)>
Victor Lopez
@VictorJL
Apr 05 2015 15:55
title, the scene created from stage.create_scene() has a method called construct, same as the actor created from title.create_actor() but they don't inherit from the same base, they have their own construct method, which does the same and assigns to the same named variables with the same signature, they are registered like this:
    chai.add(chaiscript::fun(&cw::interface::composition::scene::construct), "construct");
    chai.add(chaiscript::fun(&cw::interface::composition::actor::construct), "construct");
Jason Turner
@lefticus
Apr 05 2015 18:19
I think you might be hitting this bug: ChaiScript/ChaiScript#155
Victor Lopez
@VictorJL
Apr 05 2015 21:11
That's the same context under which I'm trying to call the lambdas. Good to know it was expected.
Victor Lopez
@VictorJL
Apr 05 2015 23:03
Found another bug, where can I submit?
It's related to anonymous namespace functions.
As it seems it is not working when you add a function inside an anonymous namespace, I'll isolate that and submit if it happens again. It's just ChaiScript taking too long when compiling.
Victor Lopez
@VictorJL
Apr 05 2015 23:56
And no, it worked fine along with debugging. I guess it was because of the memory usage within my computer and corruption in the build process. Everything is working now, the only bug I faced was #155.