Skip to content

Initialization Functions in new #17

@cernec1999

Description

@cernec1999

Consider the following case:

function regularNew() {
    temp.foo = new TServerPlayer("ropguy");
    echo(temp.foo.account);
}

GS2, in some cases, appears to call initializer functions for certain new objects. At the current moment, I've only seen it in TServerPlayer so far, but I'm sure that other objects have this as well.

Here's an example decompiled output of the above:

function regularNew()
{
    new_node#3 = new TServerPlayer("ropguy");
    fn_call#6 = <new_node.loadAccount>#5();
    <temp.foo>#7 = new_node#3;
    fn_call#11 = echo#10(<temp.foo.account>#9);
}

In the above case, the official GS2 compiler will inject a loadAccount function call after instantiating TServerPlayer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions