Skip to content

Commit

Permalink
Adds functions for retrieving state from srv/fsm.
Browse files Browse the repository at this point in the history
  • Loading branch information
archaelus committed Mar 27, 2013
1 parent 26b5ea9 commit 55a02d2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions gen_state.erl
@@ -0,0 +1,21 @@
f(State).
State = fun (Proc) ->
{status, _Pid, _, Things} = sys:get_status(Proc),
{data, PL} = lists:last(lists:nth(5, Things)),
proplists:get_value("State", PL)
end.

f(FsmState).
FsmState = fun (Proc) ->
{status, _Pid, _, Things} = sys:get_status(Proc),
{data, PL} = lists:last(lists:nth(5, Things)),
proplists:get_value("StateData", PL)
end.

f(FsmStateName).
FsmStateName = fun (Proc) ->
{status, _Pid, _, Things} = sys:get_status(Proc),
{data, PL} = lists:nth(2, lists:nth(5, Things)),
proplists:get_value("StateName", PL)
end.

0 comments on commit 55a02d2

Please sign in to comment.