Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- find_mob(MobRef) ->
- FindRef = fun(Elem) -> Elem#mob.ref =:= MobRef end,
- Q = qlc:q([X ||
- X = #world{stuff=Stuff} <- mnesia:table(world),
- case proplists:lookup_all(mob, Stuff) of
- [] -> false;
- List -> lists:any(FindRef, List)
- end]),
- F = fun() -> qlc:eval(Q) end,
- case mnesia:transaction(F) of
- {atomic, [Square]} -> Square;
- _ -> nil
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement