summaryrefslogtreecommitdiff |
diff options
author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2019-08-19 23:19:44 +0200 |
---|---|---|
committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2019-08-19 23:19:44 +0200 |
commit | 921db62f5055b8b77ae1d8c677e43f11371d90c4 (patch) | |
tree | b8683e7101aeac21f8bbb7cbd9475caad2303629 /src/shared/struct/shr_omnimods.erl | |
parent | 78f689ceed7819943b85e6c63e1c96396ca0e386 (diff) |
...
Diffstat (limited to 'src/shared/struct/shr_omnimods.erl')
-rw-r--r-- | src/shared/struct/shr_omnimods.erl | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/shared/struct/shr_omnimods.erl b/src/shared/struct/shr_omnimods.erl index ae8ba44..f452e34 100644 --- a/src/shared/struct/shr_omnimods.erl +++ b/src/shared/struct/shr_omnimods.erl @@ -80,7 +80,8 @@ -export ( [ - encode/1 + encode/1, + export/1 ] ). @@ -114,6 +115,22 @@ encode_mods (Mods) -> dict:to_list(Mods) ). +-spec mod_list_to_string_list (mods()) -> list(). +mod_list_to_string_list (Mods) -> + ( + "__MOD_LIST(" + ++ + lists:map + ( + fun ({Name, Value}) -> + io_lib:format("__MOD_~p(~p),", [Name, Value]) + end, + Mods + ) + ++ + ")" + ). + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -351,3 +368,13 @@ encode (Omnimods) -> {<<"defm">>, encode_mods(Omnimods#omnimods.defmods)} ] }. + +-spec export (type()) -> list(). +export (Omnimods) -> + ( + mod_list_to_string_list(dict:to_list(Omnimods#omnimods.attmods)) + ++ "\n" + ++ mod_list_to_string_list(dict:to_list(Omnimods#omnimods.atkmods)) + ++ "\n" + ++ mod_list_to_string_list(dict:to_list(Omnimods#omnimods.defmods)) + ). |