refrence a function from a record field

9 views
Skip to first unread message

Lars Hesel

unread,
Oct 22, 2012, 2:29:41 PM10/22/12
to zurich-erlan...@googlegroups.com
Hi

Does any of you guys know how to reference a function of using a field of a record as the module name?

Right now I do this:

    Mod = State#state.player_mod,
    {reply, {ok, Mod:name()}, State};

But I'd like to do it w/o the assignment, like:

    {reply, {ok, State#state.player_mod:name()}, State};

that doesn't compile, though :(

Cheers,
Lars

Martynas Pumputis

unread,
Oct 22, 2012, 2:31:26 PM10/22/12
to zurich-erlan...@googlegroups.com
Hi,

Just wrap into parentheses, i.e. (State#state.player_mod):name().

Best,
Martynas

Lars Hesel

unread,
Oct 22, 2012, 2:34:25 PM10/22/12
to zurich-erlan...@googlegroups.com
Wow - so simple - thanks!

Lars
Reply all
Reply to author
Forward
0 new messages