{"id":15722583,"url":"https://github.com/paweljarosz/defarc","last_synced_at":"2025-05-12T13:47:04.738Z","repository":{"id":93037216,"uuid":"487750619","full_name":"paweljarosz/defarc","owner":"paweljarosz","description":"DefArc is an Arcweave runtime for Defold, a toolset to easily create branching, interactive narratives in your games! Underneath it is a JSON parser and helper module for branching, interactive or linear conversation or any data you can create in Arcweave for Defold game engine (Lua).","archived":false,"fork":false,"pushed_at":"2022-09-16T12:02:10.000Z","size":2074,"stargazers_count":31,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T22:41:35.918Z","etag":null,"topics":["arcweave","defold","defold-module"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paweljarosz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-02T07:13:41.000Z","updated_at":"2024-12-28T12:16:12.000Z","dependencies_parsed_at":"2023-03-03T07:45:26.804Z","dependency_job_id":null,"html_url":"https://github.com/paweljarosz/defarc","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paweljarosz%2Fdefarc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paweljarosz%2Fdefarc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paweljarosz%2Fdefarc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paweljarosz%2Fdefarc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paweljarosz","download_url":"https://codeload.github.com/paweljarosz/defarc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253750424,"owners_count":21958298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arcweave","defold","defold-module"],"created_at":"2024-10-03T22:08:32.392Z","updated_at":"2025-05-12T13:47:04.713Z","avatar_url":"https://github.com/paweljarosz.png","language":"Lua","funding_links":[],"categories":["Libraries"],"sub_categories":["Programming Language"],"readme":"# DefArc - Defold module for Arcweave\n\nDefArc is a runtime for Arcweave projects, a module helping easily create interactive branching or linear conversations or quests flow - anything you can create in [Arcweave](https://arcweave.com) for [Defold game engine](https://defold.com).\n\nDefArc is a JSON parser and a set of helper functions to easily and conveniently create a dialogue flow in Lua. It comes with unit tests and an example Defold project. You can mix DefArc with other Defold assets like [RichText](https://defold.com/assets/richtext/) or [Defold Printer](https://defold.com/assets/printer/) for text animation and displaying and [Gooey](https://defold.com/assets/gooey/) or [Druid](https://defold.com/assets/druid/) for GUI handling.\n\nDefArc is an incarnation or inheritance of my first narrative module - [Defork](https://github.com/paweljarosz/defork) that was used with JSON files produced by Twinson format for open-source [Twine](https://twinery.org). Arcweave is not open-source, but its free plan allows you to create anything in a much more enhanced, advanced and professional environment with possibility to collaborate online on one project (2 editors for free plan). Arcweave offers also paid plans with larger limits like more editors for online collaboration on projects for larger teams. For solodevs or indie teams, it's a great [tool used by professionals](https://arcweave.com/customers) like CDPR, Mojang, Microsoft, Primal, etc.\n\n![DefArc logo](img/defarc_hor.png)\n\nLogo made with [DesignEvo](https://designevo.com)\n\n## Installation\n\nIn order to use DefArc in your Defold game add it to your [game.project](defold://open?path=/game.project) as a [Defold library dependency](https://defold.com/manuals/libraries/). Don't forget to fetch the libraries.\n\nOnce added, you must require the main Lua module in scripts via\n\n```\nlocal defarc = require(\"defarc.defarc\")\n```\n\nThen you need to add dialogs exported from Arcweave in a [JSON format](https://arcweave.com/docs/1.0/export) to your project. To add it, you need to provide a path in **Custom Resource** field of your *game.project* in Defold. For example, if you have your file in the assets folder in the project directory, type: assets or specifically: assets/dialogue.json. You can find more informations about custom resources in official [Defold documentation on Custom Resources here](https://defold.com/manuals/resource/).\n\n## What you can do?\n\nWith DefArc you can easily:\n\n- add linear or non-linear, interactive dialogues to your games\n- build visual novels, interactive fiction or any kind of games with narrative\n- utilize powerful Arcweave branching with code chunks\n- load and save variables changing the flow of conversations\n- load json data exported from Arcweave conversation making tool\n- get text, options and links leading to next conversation's nodes\n- store and manage current links, options and flow through nodes\n- modify data by adding actors, colors and custom text effects\n- add images, portraits, locations or emoticons from Arcweave assets\n\n\n## Defold Example\n\nThough DefArc offers over hundred of functions, but for most games purposes, you would practically narrow the usage to just few. At the end of this Readme you can find a whole API documentation. If you want only a quick overview, take a look at example lines below:\n\n1) Load the project from JSON resource:\n\n```\n\tdefarc.load(\"/dialogs/test_board.json\") \t\t-- loading Arcweave exported JSON from custom resources\n```\n\n2) Select an element to start working with it, e.g. displaying the text and options.\n\n```\n\tdefarc.select_element(\"Example welcome\") \t\t-- selecting element by its title from Arcweave element or by element id\n```\n\n4) Get text and options_table:\n```\n\tlocal text = defarc.get_text()\t\t\t\t\t-- get parsed element's content\n\tlocal options = defarc.get_options_table()\t\t-- get parsed options/labels in a Lua table\n```\n\n5) Put it in GUI, for example:\n\n```\n\tfunction show_current_text_and_options()\n\t\tlocal text = defarc.get_text()\n\t\tlocal options = defarc.get_options_table()\n\n\t\tgui.set_text(gui.get_node(\"NPC\"), text) \t-- set text\n\n\t\tfor i=1,3 do                            \t-- set 3 corresponding options\n\t\t\tlocal node = gui.get_node(\"Option_\"..i)\n\t\t\tlocal option = options[i] and options[i].label or \"\"\n\t\t\tgui.set_text(node, option)\n\t\tend\n\tend\n```\n\n6) Add input handling and proceed to next element after choosing an option, for example:\n\n```\n\tfunction on_input(self, action_id, action)\n\t\tfor i = 1,3 do\n\t\t\tlocal current_option_node = gui.get_node(\"Option_\"..i)\n\n\t\t\tif gui.pick_node(current_option_node, action.x, action.y) then\t-- handle clicking on option nodes\n\t\t\t\tif action.pressed then\n\t\t\t\t\tgui.set_scale(current_option_node, vmath.vector4(0.9))\t-- scale clicked options a little\n\t\t\t\telseif action.released then\n\t\t\t\t\tgui.set_scale(current_option_node, vmath.vector4(1))\t-- scale it back when released\n\t\t\t\t\tdefarc.select_element(options[i].target_id)\t\t\t\t-- select next element\n\t\t\t\t\tshow_current_text_and_options()\t\t\t\t\t\t\t-- display next text and options\n\t\t\t\tend\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\tend\n```\n\nThe repository contains 2 examples, that both runs a simple conversation, where you can choose each of the options. For simple application - when reaching an end - it starts again. For Arcweave example - there is a secret, sucessful ending if you find a way to get pass a guardian.\n\n![Example app](img/screenshot_example_app_arcweave.png)\n\n## Arcweave\n\nArcweave allows to create complex diagrams that can be used to build linear dialogues, non-linear branching conversations with variables or quest or story flow design.\nArcweave offers a lot of options, all of them are available in free plan. Check out Arcweave features [here](https://arcweave.com).\n\n![Example Arcweave](img/screenshot_example_arcweave.png)\n\n## ArcScripts\n\nArcweave offers some logic functionality through custom syntax code - ArcScripts. DefArc supports gradually more and more of this functionality, though code parsing is a tedious work for a developer like me, so please be patient for the updates and bear in mind that not everything might work in current state! If this is the case, don't hesitate to report it to me - I will be updating it :)\n\nCurrently supporting:\n- single statement conditions, e.g. if variable_name\n- negatation operator, e.g. if !variable_name\n- assignments in the text and options, e.g. variable_name = true\n\nDefArc is automatically parsing the element's content and whenever it reaches any ArcScript code, it tries to parse it and if there is any operation on the global variables - it saves and uses the internal global variables table, exposed to you as `defarc.global_variables` Lua table.\nYou can change or extend parsing behavior, by overwriting the currently used behavior-defining function, also exposed as:\n```\ndefarc.arcscript_code_parser(splitted, start_at)\n```\ntaking as parameters a Lua table with splitted by \"\u003c\" and \"\u003e\" elements and additional parameter start_at, identifying the place in such table, where a `code` tag appeared, meaning a beginning of ArcScript chunk.\n\n## HTML tags parsing\n\nDefArc also offers a custom HTML tags parsing. The default parser for most of the tags basically just removes them from the contents or replaces them with quotation marks or adds @ to notify a meant-to-be link.\nIf you want to modify the behavior, because for example you want to parse the tags to be usable with Defold RichText or Printer modules - it is located in \"defarc.parser\" as default_tag_parser and is a Lua table with strings to match from the tags as keys (trimmed from `\u003c` and `\u003e`, so e.g. \"a href\" and \"/a\") and functions to return a proper string instead of such whole tag. This might be to complicated and not so efficient, but for now it is a perfect solution to parse all HTML tags that could occur in Arcweave (or at least that occured in Arcweave example and my projects).\n\nI plan to add tag parsers for RichText and Defold Printer, but for now, if you need it now, you can customize the default, like this:\n\nFor RichText Example could be to overwrite default \u003cstrong\u003e tag parameter, where e.g. \u003cb\u003e is available:\nrichtext_tag_parser[\"/strong\"] = function() return \"\u003c/b\u003e\u003c/color\u003e\" end\t-- for closing tag\ntichtext_tag_parser[\"strong\"] = function() return \"\u003ccolor=red\u003e\u003cb\u003e\" end\t-- for opening tag\n\nFor Defold Printer a different styling syntax is used, so an example like this could be used:\ndprinter_tag_parser[\"/strong\"] = function() return \"{/}\" end\t-\t\t\t-- for closing tag\ndprinter_tag_parser[\"strong\"] = function() return \"{strong_style}\" end\t-- for opening tag (if strong_style is known to Defold Printer)\n\n\n## Tests\n\nTo check if DefArc is working you can run a set of unit and functional tests from the example:\n\n```\nlocal defarc_test = require \"defarc.defarc_test\"\ndefarc_test.run()\n```\n\n## Contributions and maintenance\n\nI wrote this project solo as a basic parser for Arcweave projects, but it grew up and and will grow up for sure, as I am using it actively for game development with Defold. It is a Lua module, that beside of loading using a Defold json parser, could be possibly used in any Lua based project. If you would like to help me or contribute, don't hesitate - it's open source and I'm eager for this!\n\n## License\n\nDefArc is released under MIT license.\n\n___\n\n# DefArc API\n\n## Project related:\n\n### load(resource)\nLoads a Custom Resource with a JSON dialogue data. This function saves this data inside DefArc module for convenience and optimization, so there is no need to provide dialogue (aka conversation) data for every function, that takes it as a parameter. This makes this function to be called first a necessity.\nOne must provide a proper JSON format data to assure DefArc will parse it correctly. Returns `nil`, if there the resource couldn't have been loaded.\n\n* **PARAMETER:** `resource` (string) - an address of a custom resource containing JSON format dialogue data.\n* **RETURNS:** `dialogue_data` (table) - a loaded table with dialogue data.\n\n```\n\tlocal dialogue_data = defarc.load(\"/assets/dialogue.json\")\n```\n\n### create(resource)\nLoads a Custom Resource with a JSON dialogue data. This function creates and returns an instance of DefArc for an OOP approach.\nOne must provide a proper JSON format data to assure DefArc will parse it correctly. Returns `nil`, if there the resource couldn't have been loaded.\n\n* **PARAMETER:** `resource` (string) - an address of a custom resource containing JSON format dialogue data.\n* **RETURNS:** `defarc_instance` (metatable) - a created instance with dialogue data and all the functions.\n\n```\n\tlocal defarc_instance = defarc.create(\"/assets/dialogue.json\")\n\tlocal project_name = defarc_instance.get_project_name()\t-- then you can use instance as an \"object\"\n```\n\n### get_project_name()\nReturns the Project Name of the loaded data.\n\n* **RETURNS:** `project_name` (string) - a project name\n\n```\n\tlocal project_name = defarc.get_project_name()\n```\n\n### get_project_cover()\nReturns an asset_id to an asset set as a Project Cover. One can then use this id to obtain all data about an asset.\n\n* **RETURNS:** `cover_asset_id` (asset_id) - a project name\n\n```\n\tlocal cover_asset_id = defarc.get_project_cover()\n```\n\n## Conversation Flow:\n\n### get_text([element])\nReturns an element text of selected element data. This function returns a proper element text if proper element_id or title is provided, otherwise it returns a element text of selected element_table.\n\n* **PARAMETER:** `element` (string, optional) - an id or title of an element from Arcweave JSON or Lua table with element data (element_table)\n* **RETURNS:** `text` (string) - a string with element text, e.g. stripped of beginning and ending paragraph tags. It could be used as an text to display to players.\n\n```\n\tlocal npc_text = defarc.get_text()\n```\n\n### get_options_table([element])\nReturns a table with options for selected element data. This function returns a proper option table if proper element_id or title is provided, otherwise it returns an option table of selected element_table.\n\n* **PARAMETER:** `element` (string, optional) - an id or title of an element from Arcweave JSON or Lua table with element data (element_table)\n* **RETURNS:** `options_table` (table) - a table with options, where for each key (order number), value is a table with option data (with fields: *target_id*, *label*, *theme*, *target_type*)\n\n```\n\tlocal player_options = defarc.get_options_table()\n```\n\n## Other:\n\n### verbose (bool)\nA flag determining, whether warnings and errors should be printed in the log.\n\n```\n\tdefarc.verbose = true -- enable printing DefArc informations\n```\n\n### dialogue_data (table)\nThe whole table with data parsed from the resource. It is used in all functions.\n\n```\n\tlocal project_name = defarc.dialogue_data.name -- instead of defarc.get_project_name()\n```\n\n## Boards:\n\n### get_boards()\nReturns all boards of the loaded project.\n\n* **RETURNS:** `boards_table` (table) - a table with all the boards in the project, where key is a board_id and value is a table with board contents. Returns `nil`, if there are no boards in the project.\n\n```\n\tlocal project_boards = defarc.get_boards()\n```\n\n### get_boards_names()\nReturns a table with ids and names of the boards of the loaded project.\n\n* **RETURNS:** `boards_names_table` (table) - a table with all the boards in the project, where key is a board_id and value is a board name\n\n```\n\tlocal project_boards_names = defarc.get_boards_names()\n```\n\n### get_board_by_id(board_id)\nReturns a table with selected board data. One need to provide a proper board id, otherwise it will return nil.\n\n* **PARAMETER:** `board_id` (string) - an id of a board from Arcweave JSON\n* **RETURNS:** `board_table` (table) - a table with data regarding selected board\n\n```\n\tlocal board_table = defarc.get_board_by_id(\"proper-id\")\n```\n\n### get_board_by_name(board_name)\nReturns a table with selected board data. One need to provide a proper board name, otherwise it will return nil.\n\n* **PARAMETER:** `board_name` (string) - a name of a board from Arcweave JSON\n* **RETURNS:** `board_table` (table) - a table with data regarding selected board\n\n```\n\tlocal board_table = defarc.get_board_by_name(\"proper-name\")\n```\n\n### get_board([board])\nReturns a table with selected board data. This function returns a proper board if proper board_id or board_name is provided, otherwise it returns a selected board_table.\n\n* **PARAMETER:** `board` (string, optional) - an id or name of a board from Arcweave JSON or Lua table with board data (board_table)\n* **RETURNS:** `board_table` (table) - a table with data regarding selected board\n\n```\n\tlocal board_table = defarc.get_board() -- will return a saved board, if there is any saved (selected by below functions)\n```\n\n### select_board_by_id(board_id)\nSelects and saves a table with board data inside DefArc module. One need to provide a proper board id, otherwise it will save nil.\n\n* **PARAMETER:** `board_id` (string) - an id of a board from Arcweave JSON\n\n```\n\tdefarc.select_board_by_id(\"proper-id\") -- will select and save inside DefArc module a board data for given id\n```\n\n### select_board_by_name(board_name)\nSelects and saves a table with board data inside DefArc module. One need to provide a proper board name, otherwise it will save nil.\n\n* **PARAMETER:** `board_name` (string) - a name of a board from Arcweave JSON\n\n```\n\tdefarc.select_board_by_name(\"proper-name\") -- will select and save inside DefArc module a board data for given name\n```\n\n### select_board(board)\nSelects and saves a table with board data inside DefArc module. One need to provide a proper board name or board id or board Lua table, otherwise it will save nil.\n\n* **PARAMETER:** `board` (string) - an id or name of a board from Arcweave JSON or Lua table with board data (board_table)\n\n```\n\tdefarc.select_board(\"proper-name\") -- will select and save inside DefArc module a board data for given name\n```\n\n## Board Content:\n\n### get_board_name([board])\nReturns a board name of selected board data. This function returns a proper board name if proper board_id or board_name is provided, otherwise it returns a board name of selected board_table.\n\n* **PARAMETER:** `board` (string, optional) - an id or name of a board from Arcweave JSON or Lua table with board data (board_table)\n* **RETURNS:** `board_table` (table) - a table with data regarding selected board\n\n```\n\tlocal board_name = defarc.get_board_name()\n```\n\n### get_board_notes([board])\nReturns a table with notes data of selected board data. This function returns a proper notes table if proper board_id or board_name is provided, otherwise it returns a notes table of selected board_table. If there are no notes in the board, returns nil.\n\n* **PARAMETER:** `board` (string, optional) - an id or name of a board from Arcweave JSON or Lua table with board data (board_table)\n* **RETURNS:** `notes_table` (table) - a table with data regarding selected board notes - for each key (which is *note_id)*, value is a table with note data (with fields: *theme* (color of the note in Arcweave) and *content*)\n\n```\n\tlocal note_content = defarc.get_board_notes()[\"some-note-id\"].content\n```\n\n### get_board_jumpers([board])\nReturns a table with jumpers data of selected board data. This function returns a proper jumpers table if proper board_id or board_name is provided, otherwise it returns a jumpers table of selected board_table. If there are no jumpers in the board, returns nil.\n\n* **PARAMETER:** `board` (string, optional) - an id or name of a board from Arcweave JSON or Lua table with board data (board_table)\n* **RETURNS:** `jumpers_table` (table) - a table with data regarding selected board jumpers - for each key (which is *jumper_id*), value is an *element_id* to which the jumper links\n\n```\n\tlocal jump_to = defarc.get_board_jumpers()[\"some-jumper-id\"]\n```\n\n### get_board_branches([board])\nReturns a table with branches data of selected board data. This function returns a proper branches table if proper board_id or board_name is provided, otherwise it returns a branches table of selected board_table.\n\n* **PARAMETER:** `board` (string, optional) - an id or name of a board from Arcweave JSON or Lua table with board data (board_table)\n* **RETURNS:** `branches_table` (table) - a table with data regarding selected board branches - for each key (which is *branch_id*), value is a table with branch data\n\n```\n\tlocal board_branches = defarc.get_board_branches()\n```\n\n### get_board_elements([board])\nReturns a table with elements data of selected board data. This function returns a proper elements table if proper board_id or board_name is provided, otherwise it returns an elements table of selected board_table. If there are no elements in the board, returns nil.\n\n* **PARAMETER:** `board` (string, optional) - an id or name of a board from Arcweave JSON or Lua table with board data (board_table)\n* **RETURNS:** `elements_table` (table) - a table with data regarding selected board elements - for each key (which is *element_id*), value is a table with element data\n\n```\n\tlocal board_elements = defarc.get_board_elements()\n```\n\n### get_board_connections([board])\nReturns a table with connections data of selected board data. This function returns a proper connections table if proper board_id or board_name is provided, otherwise it returns a connections table of selected board_table. If there are no connections in the board, returns nil.\n\n* **PARAMETER:** `board` (string, optional) - an id or name of a board from Arcweave JSON or Lua table with board data (board_table)\n* **RETURNS:** `connections_table` (table) - a table with data regarding selected board connections - for each key (which is *connection_id*), value is a table with connection data\n\n```\n\tlocal board_connections = defarc.get_board_connections()\n```\n\n## Components:\n\n### get_components()\nReturns a table with all components of the project.\n\n* **RETURNS:** `components_table` (table) - a table with data regarding components of the project\n\n```\n\tlocal components = defarc.get_components()\n```\n\n### get_components_names()\nReturns a table with all components names of the project.\n\n* **RETURNS:** `components_names_table` (table) - a table where for each key (which is a *component_id*), value is a component name\n\n```\n\tlocal components_names = defarc.get_components_names()\n```\n\n### get_component_by_id(component_id)\nReturns a table with selected component data. One need to provide a proper component id, otherwise it will return nil.\n\n* **PARAMETER:** `component_id` (string) - an id of a component from Arcweave JSON\n* **RETURNS:** `component_table` (table) - a table with data regarding selected component\n\n```\n\tlocal component_table = defarc.get_component_by_id(\"proper-id\")\n```\n\n### get_component_by_name(component_name)\nReturns a table with selected component data. One need to provide a proper component name, otherwise it will return nil.\n\n* **PARAMETER:** `component_name` (string) - a name of a component from Arcweave JSON\n* **RETURNS:** `component_table` (table) - a table with data regarding selected component\n\n```\n\tlocal component_table = defarc.get_component_by_name(\"proper-name\")\n```\n\n### get_component([component])\nReturns a table with selected component data. This function returns a proper component if proper component_id or component_name is provided, otherwise it returns a selected component_table.\n\n* **PARAMETER:** `component` (string, optional) - an id or name of a component from Arcweave JSON or Lua table with component data (component_table)\n* **RETURNS:** `component_table` (table) - a table with data regarding selected component\n\n```\n\tlocal component_table = defarc.get_component() -- will return a saved component, if there is any saved (selected by below functions)\n```\n\n### select_component_by_id(component_id)\nSelects and saves a table with component data inside DefArc module. One need to provide a proper component id, otherwise it will save nil.\n\n* **PARAMETER:** `component_id` (string) - an id of a component from Arcweave JSON\n\n```\n\tdefarc.select_component_by_id(\"proper-id\") -- will select and save inside DefArc module a component data for given id\n```\n\n### select_component_by_name(component_name)\nSelects and saves a table with component data inside DefArc module. One need to provide a proper component name, otherwise it will save nil.\n\n* **PARAMETER:** `component_name` (string) - a name of a component from Arcweave JSON\n\n```\n\tdefarc.select_component_by_name(\"proper-name\") -- will select and save inside DefArc module a component data for given name\n```\n\n### select_component(component)\nSelects and saves a table with component data inside DefArc module. One need to provide a proper component name or component id or component Lua table, otherwise it will save nil.\n\n* **PARAMETER:** `component` (string) - an id or name of a component from Arcweave JSON or Lua table with component data (component_table)\n\n```\n\tdefarc.select_component(\"proper-name\") -- will select and save inside DefArc module a component data for given name\n```\n\n## Component Content\n\n### get_component_name([component])\nReturns a component name of selected component data. This function returns a proper component name if proper component_id or component_name is provided, otherwise it returns a component name of selected component_table.\n\n* **PARAMETER:** `component` (string, optional) - an id or name of a component from Arcweave JSON or Lua table with component data (component_table)\n* **RETURNS:** `component_name` (string) - a string with component name\n\n```\n\tlocal component_name = defarc.get_component_name()\n```\n\n### get_component_attributes([component])\nReturns a table with attributes data of selected component data. This function returns a proper attributes table if proper component_id or component_name is provided, otherwise it returns a attributes table of selected component_table. If there are no attributes in the component, returns nil.\n\n* **PARAMETER:** `component` (string, optional) - an id or name of a component from Arcweave JSON or Lua table with component data (component_table)\n* **RETURNS:** `attributes_table` (table) - a table with data regarding selected component attributes - for each key (which is *attribute_id*), value is an *element_id* to which the attribute links\n\n```\n\tlocal jump_to = defarc.get_component_attributes()[\"some-attribute-id\"]\n```\n\n### get_component_assets([component])\nReturns a table with assets data of selected component data. This function returns a proper assets table if proper component_id or component_name is provided, otherwise it returns a assets table of selected component_table. If there are no assets in the component, returns nil.\n\n* **PARAMETER:** `component` (string, optional) - an id or name of a component from Arcweave JSON or Lua table with component data (component_table)\n* **RETURNS:** `assets_table` (table) - a table with data regarding selected component assets - for each key (which is *asset_id*), value is an *element_id* to which the asset links\n\n```\n\tlocal jump_to = defarc.get_component_assets()[\"some-asset-id\"]\n```\n\n## Attributes:\n\n### get_attributes()\nReturns a table with all attributes of the project.\n\n* **RETURNS:** `attributes_table` (table) - a table with data regarding attributes of the project\n\n```\n\tlocal attributes = defarc.get_attributes()\n```\n\n### get_attributes_names()\nReturns a table with all attributes names of the project.\n\n* **RETURNS:** `attributes_names_table` (table) - a table where for each key (which is a *attribute_id*), value is a attribute name\n\n```\n\tlocal attributes_names = defarc.get_attributes_names()\n```\n\n### get_attribute_by_id(attribute_id)\nReturns a table with selected attribute data. One need to provide a proper attribute id, otherwise it will return nil.\n\n* **PARAMETER:** `attribute_id` (string) - an id of a attribute from Arcweave JSON\n* **RETURNS:** `attribute_table` (table) - a table with data regarding selected attribute\n\n```\n\tlocal attribute_table = defarc.get_attribute_by_id(\"proper-id\")\n```\n\n### get_attribute_by_name(attribute_name)\nReturns a table with selected attribute data. One need to provide a proper attribute name, otherwise it will return nil.\n\n* **PARAMETER:** `attribute_name` (string) - a name of a attribute from Arcweave JSON\n* **RETURNS:** `attribute_table` (table) - a table with data regarding selected attribute\n\n```\n\tlocal attribute_table = defarc.get_attribute_by_name(\"proper-name\")\n```\n\n### get_attribute([attribute])\nReturns a table with selected attribute data. This function returns a proper attribute if proper attribute_id or attribute_name is provided, otherwise it returns a selected attribute_table.\n\n* **PARAMETER:** `attribute` (string, optional) - an id or name of a attribute from Arcweave JSON or Lua table with attribute data (attribute_table)\n* **RETURNS:** `attribute_table` (table) - a table with data regarding selected attribute\n\n```\n\tlocal attribute_table = defarc.get_attribute() -- will return a saved attribute, if there is any saved (selected by below functions)\n```\n\n### select_attribute_by_id(attribute_id)\nSelects and saves a table with attribute data inside DefArc module. One need to provide a proper attribute id, otherwise it will save nil.\n\n* **PARAMETER:** `attribute_id` (string) - an id of a attribute from Arcweave JSON\n\n```\n\tdefarc.select_attribute_by_id(\"proper-id\") -- will select and save inside DefArc module a attribute data for given id\n```\n\n### select_attribute_by_name(attribute_name)\nSelects and saves a table with attribute data inside DefArc module. One need to provide a proper attribute name, otherwise it will save nil.\n\n* **PARAMETER:** `attribute_name` (string) - a name of a attribute from Arcweave JSON\n\n```\n\tdefarc.select_attribute_by_name(\"proper-name\") -- will select and save inside DefArc module a attribute data for given name\n```\n\n### select_attribute(attribute)\nSelects and saves a table with attribute data inside DefArc module. One need to provide a proper attribute name or attribute id or attribute Lua table, otherwise it will save nil.\n\n* **PARAMETER:** `attribute` (string) - an id or name of a attribute from Arcweave JSON or Lua table with attribute data (attribute_table)\n\n```\n\tdefarc.select_attribute(\"proper-name\") -- will select and save inside DefArc module a attribute data for given name\n```\n\n## Attribute Content:\n\n### get_attribute_name([attribute])\nReturns a attribute name of selected attribute data. This function returns a proper attribute name if proper attribute_id or attribute_name is provided, otherwise it returns a attribute name of selected attribute_table.\n\n* **PARAMETER:** `attribute` (string, optional) - an id or name of a attribute from Arcweave JSON or Lua table with attribute data (attribute_table)\n* **RETURNS:** `attribute_name` (string) - a string with attribute name\n\n```\n\tlocal attribute_name = defarc.get_attribute_name()\n```\n\n### get_attribute_value([attribute])\nReturns a attribute value table of selected attribute data. This function returns a proper attribute name if proper attribute_id or attribute_name is provided, otherwise it returns a attribute value of selected attribute_table.\n\n* **PARAMETER:** `attribute` (string, optional) - an id or name of a attribute from Arcweave JSON or Lua table with attribute data (attribute_table)\n* **RETURNS:** `attribute_value` (table) - a table with fileds *data* and *type*\n\n```\n\tlocal attribute_value = defarc.get_attribute_value()\n```\n\n### get_attribute_data([attribute])\nReturns a attribute value data of selected attribute data. This function returns a proper attribute name if proper attribute_id or attribute_name is provided, otherwise it returns a attribute value data of selected attribute_table.\n\n* **PARAMETER:** `attribute` (string, optional) - an id or name of a attribute from Arcweave JSON or Lua table with attribute data (attribute_table)\n* **RETURNS:** `attribute_data` (string or table) - a string with attribute value data or a table with components list\n\n```\n\tlocal attribute_value_data = defarc.get_attribute_data()\n```\n\n### get_attribute_type([attribute])\nReturns a attribute value type of selected attribute data. This function returns a proper attribute name if proper attribute_id or attribute_name is provided, otherwise it returns a attribute value type of selected attribute_table.\n\n* **PARAMETER:** `attribute` (string, optional) - an id or name of a attribute from Arcweave JSON or Lua table with attribute data (attribute_table)\n* **RETURNS:** `attribute_type` (string) - a string with attribute value type, e.g. \"string\", \"integer\", \"component-list\"\n\n```\n\tlocal attribute_value_type = defarc.get_attribute_type()\n```\n\n## Assets:\n\n### get_assets()\nReturns a table with all assets of the project. If there are no assets in the project returns nil.\n\n* **RETURNS:** `assets_table` (table) - a table with data regarding assets of the project\n\n```\n\tlocal assets = defarc.get_assets()\n```\n\n### get_assets_names()\nReturns a table with all assets names of the project.\n\n* **RETURNS:** `assets_names_table` (table) - a table where for each key (which is a *asset_id*), value is a asset name\n\n```\n\tlocal assets_names = defarc.get_assets_names()\n```\n\n### get_asset_by_id(asset_id)\nReturns a table with selected asset data. One need to provide a proper asset id, otherwise it will return nil.\n\n* **PARAMETER:** `asset_id` (string) - an id of a asset from Arcweave JSON\n* **RETURNS:** `asset_table` (table) - a table with data regarding selected asset\n\n```\n\tlocal asset_table = defarc.get_asset_by_id(\"proper-id\")\n```\n\n### get_asset_by_name(asset_name)\nReturns a table with selected asset data. One need to provide a proper asset name and there must be such named asset, otherwise it returns nil.\n\n* **PARAMETER:** `asset_name` (string) - a name of a asset from Arcweave JSON\n* **RETURNS:** `asset_table` (table) - a table with data regarding selected asset\n\n```\n\tlocal asset_table = defarc.get_asset_by_name(\"proper-name\")\n```\n\n### get_asset([asset])\nReturns a table with selected asset data. This function returns a proper asset if proper asset_id or asset_name is provided, otherwise it returns a selected asset_table.\n\n* **PARAMETER:** `asset` (string, optional) - an id or name of a asset from Arcweave JSON or Lua table with asset data (asset_table)\n* **RETURNS:** `asset_table` (table) - a table with data regarding selected asset\n\n```\n\tlocal asset_table = defarc.get_asset() -- will return a saved asset, if there is any saved (selected by below functions)\n```\n\n### select_asset_by_id(asset_id)\nSelects and saves a table with asset data inside DefArc module. One need to provide a proper asset id, otherwise it will save nil.\n\n* **PARAMETER:** `asset_id` (string) - an id of a asset from Arcweave JSON\n\n```\n\tdefarc.select_asset_by_id(\"proper-id\") -- will select and save inside DefArc module a asset data for given id\n```\n\n### select_asset_by_name(asset_name)\nSelects and saves a table with asset data inside DefArc module. One need to provide a proper asset name, otherwise it will save nil.\n\n* **PARAMETER:** `asset_name` (string) - a name of a asset from Arcweave JSON\n\n```\n\tdefarc.select_asset_by_name(\"proper-name\") -- will select and save inside DefArc module a asset data for given name\n```\n\n### select_asset(asset)\nSelects and saves a table with asset data inside DefArc module. One need to provide a proper asset name or asset id or asset Lua table, otherwise it will save nil.\n\n* **PARAMETER:** `asset` (string) - an id or name of a asset from Arcweave JSON or Lua table with asset data (asset_table)\n\n```\n\tdefarc.select_asset(\"proper-name\") -- will select and save inside DefArc module a asset data for given name\n```\n\n## Asset Content:\n\n### get_asset_name([asset])\nReturns a asset name of selected asset data. This function returns a proper asset name if proper asset_id or asset_name is provided, otherwise it returns a asset name of selected asset_table.\n\n* **PARAMETER:** `asset` (string, optional) - an id or name of a asset from Arcweave JSON or Lua table with asset data (asset_table)\n* **RETURNS:** `asset_name` (string) - a string with asset name\n\n```\n\tlocal asset_name = defarc.get_asset_name()\n```\n\n### get_asset_type([asset])\nReturns a asset type of selected asset data. This function returns a proper asset name if proper asset_id or asset_name is provided, otherwise it returns a asset type of selected asset_table.\n\n* **PARAMETER:** `asset` (string, optional) - an id or name of a asset from Arcweave JSON or Lua table with asset data (asset_table)\n* **RETURNS:** `asset_type` (string) - a string with asset type e.g. \"image\"\n\n```\n\tlocal asset_type = defarc.get_asset_type()\n```\n\n### get_asset_children([asset])\nReturns a table with asset children of selected asset data. This function returns a proper asset name if proper asset_id or asset_name is provided, otherwise it returns a children table of selected asset_table.\n\n* **PARAMETER:** `asset` (string, optional) - an id or name of a asset from Arcweave JSON or Lua table with asset data (asset_table)\n* **RETURNS:** `asset_children` (table) - a table with asset children, where each entry is another asset id \n\n```\n\tlocal asset_child_id = defarc.get_asset_children()[\"some-proper-asset-id\"]\n```\n\n## Global Variables:\n\n### get_variables()\nReturns a table with all variables of the project. If there are no global variables in the project, it returns nil.\n\n* **RETURNS:** `variables_table` (table) - a table with data regarding variables of the project\n\n```\n\tlocal variables = defarc.get_variables()\n```\n\n### get_variables_names()\nReturns a table with all variables names of the project.\n\n* **RETURNS:** `variables_names_table` (table) - a table where for each key (which is a *variable_id*), value is a variable name\n\n```\n\tlocal variables_names = defarc.get_variables_names()\n```\n\n### get_variable_by_id(variable_id)\nReturns a table with selected variable data. One need to provide a proper variable id, otherwise it will return nil.\n\n* **PARAMETER:** `variable_id` (string) - an id of a variable from Arcweave JSON\n* **RETURNS:** `variable_table` (table) - a table with data regarding selected variable\n\n```\n\tlocal variable_table = defarc.get_variable_by_id(\"proper-id\")\n```\n\n### get_variable_by_name(variable_name)\nReturns a table with selected variable data. One need to provide a proper variable name, otherwise it will return nil.\n\n* **PARAMETER:** `variable_name` (string) - a name of a variable from Arcweave JSON\n* **RETURNS:** `variable_table` (table) - a table with data regarding selected variable\n\n```\n\tlocal variable_table = defarc.get_variable_by_name(\"proper-name\")\n```\n\n### get_variable([variable])\nReturns a table with selected variable data. This function returns a proper variable if proper variable_id or variable_name is provided, otherwise it returns a selected variable_table.\n\n* **PARAMETER:** `variable` (string, optional) - an id or name of a variable from Arcweave JSON or Lua table with variable data (variable_table)\n* **RETURNS:** `variable_table` (table) - a table with data regarding selected variable\n\n```\n\tlocal variable_table = defarc.get_variable() -- will return a saved variable, if there is any saved (selected by below functions)\n```\n\n### select_variable_by_id(variable_id)\nSelects and saves a table with variable data inside DefArc module. One need to provide a proper variable id, otherwise it will save nil.\n\n* **PARAMETER:** `variable_id` (string) - an id of a variable from Arcweave JSON\n\n```\n\tdefarc.select_variable_by_id(\"proper-id\") -- will select and save inside DefArc module a variable data for given id\n```\n\n### select_variable_by_name(variable_name)\nSelects and saves a table with variable data inside DefArc module. One need to provide a proper variable name, otherwise it will save nil.\n\n* **PARAMETER:** `variable_name` (string) - a name of a variable from Arcweave JSON\n\n```\n\tdefarc.select_variable_by_name(\"proper-name\") -- will select and save inside DefArc module a variable data for given name\n```\n\n### select_variable(variable)\nSelects and saves a table with variable data inside DefArc module. One need to provide a proper variable name or variable id or variable Lua table, otherwise it will save nil.\n\n* **PARAMETER:** `variable` (string) - an id or name of a variable from Arcweave JSON or Lua table with variable data (variable_table)\n\n```\n\tdefarc.select_variable(\"proper-name\") -- will select and save inside DefArc module a variable data for given name\n```\n\n## Global Variable Content:\n\n### get_variable_name([variable])\nReturns a variable name of selected variable data. This function returns a proper variable name if proper variable_id or variable_name is provided, otherwise it returns a variable name of selected variable_table.\n\n* **PARAMETER:** `variable` (string, optional) - an id or name of a variable from Arcweave JSON or Lua table with variable data (variable_table)\n* **RETURNS:** `variable_name` (string) - a string with variable name\n\n```\n\tlocal variable_name = defarc.get_variable_name()\n```\n\n### get_variable_type([variable])\nReturns a variable type of selected variable data. This function returns a proper variable name if proper variable_id or variable_name is provided, otherwise it returns a variable type of selected variable_table.\n\n* **PARAMETER:** `variable` (string, optional) - an id or name of a variable from Arcweave JSON or Lua table with variable data (variable_table)\n* **RETURNS:** `variable_type` (string) - a string with variable type e.g. \"integer\", \"string\", \"boolean\", float\"\n\n```\n\tlocal variable_type = defarc.get_variable_type()\n```\n\n### get_variable_value([variable])\nReturns a variable value of selected variable data. This function returns a proper variable name if proper variable_id or variable_name is provided, otherwise it returns a variable value of selected variable_table.\n\n* **PARAMETER:** `variable` (string, optional) - an id or name of a variable from Arcweave JSON or Lua table with variable data (variable_table)\n* **RETURNS:** `variable_value (string) - a string with variable value in string format\n\n```\n\tlocal variable_value = defarc.get_variable_value()\n```\n\n## Save/Load Global Variable:\n\n### save_variable(variable_name, new_value)\nSaves a variable inside DefArc module, for proper operations on it. The function changes its format from string to a proper type, e.g. a number or boolean.\n\n* **PARAMETER:** `variable_name` (string) - a proper name of a variable from Arcweave JSON\n* **PARAMETER:** `new_value` (any type) - a new value that will be converted and saved to a variable inside DefArc module\n* **RETURNS:** `result` (boolean) - true if conversion and saving was successful, false otherwise\n\n```\n\tlocal result = defarc.save_variable(\"quest_1_completed\", true)\n```\n\n### load_variable(variable_name)\nReturns a converted and saved variable value of selected variable. This function returns a proper variable value if proper variable_name is provided and that variable exists, otherwise returns nil.\n\n* **PARAMETER:** `variable_name` (string) - a proper name of a variable from Arcweave JSON\n* **RETURNS:** `variable_value` (any type) - a value converted and saved to a variable inside DefArc module\n\n```\n\tlocal is_quest_1_completed = defarc.load_variable(\"quest_1_completed\")\n```\n\n## Jumpers:\n\n### get_jumpers()\nReturns a table with all jumpers of the project.\n\n* **RETURNS:** `jumpers_table` (table) - a table with data regarding jumpers of the project\n\n```\n\tlocal jumpers = defarc.get_jumpers()\n```\n\n### get_jumpers_element_ids()\nReturns a table with all jumpers element_ids of the project.\n\n* **RETURNS:** `jumpers_element_ids_table` (table) - a table where for each key (which is a *jumper_id*), value is a jumper element_id\n\n```\n\tlocal jumpers_element_ids = defarc.get_jumpers_element_ids()\n```\n\n### get_jumper_by_id(jumper_id)\nReturns a table with selected jumper data. One need to provide a proper jumper id, otherwise it will return nil.\n\n* **PARAMETER:** `jumper_id` (string) - an id of a jumper from Arcweave JSON\n* **RETURNS:** `jumper_table` (table) - a table with data regarding selected jumper\n\n```\n\tlocal jumper_table = defarc.get_jumper_by_id(\"proper-id\")\n```\n\n### get_jumper_by_element_id(element_id)\nReturns a table with selected jumper data. One need to provide a proper jumper element_id, otherwise it will return nil.\n\n* **PARAMETER:** `element_id` (string) - an element_id of a jumper from Arcweave JSON\n* **RETURNS:** `jumper_table` (table) - a table with data regarding selected jumper\n\n```\n\tlocal jumper_table = defarc.get_jumper_by_element_id(\"proper-element_id\")\n```\n\n### get_jumper([jumper])\nReturns a table with selected jumper data. This function returns a proper jumper if proper jumper_id or element_id is provided, otherwise it returns a selected jumper_table.\n\n* **PARAMETER:** `jumper` (string, optional) - an id or element_id of a jumper from Arcweave JSON or Lua table with jumper data (jumper_table)\n* **RETURNS:** `jumper_table` (table) - a table with data regarding selected jumper\n\n```\n\tlocal jumper_table = defarc.get_jumper() -- will return a saved jumper, if there is any saved (selected by below functions)\n```\n\n### select_jumper_by_id(jumper_id)\nSelects and saves a table with jumper data inside DefArc module. One need to provide a proper jumper id, otherwise it will save nil.\n\n* **PARAMETER:** `jumper_id` (string) - an id of a jumper from Arcweave JSON\n\n```\n\tdefarc.select_jumper_by_id(\"proper-id\") -- will select and save inside DefArc module a jumper data for given id\n```\n\n### select_jumper_by_element_id(element_id)\nSelects and saves a table with jumper data inside DefArc module. One need to provide a proper jumper element_id, otherwise it will save nil.\n\n* **PARAMETER:** `element_id` (string) - an element_id of a jumper from Arcweave JSON\n\n```\n\tdefarc.select_jumper_by_element_id(\"proper-element_id\") -- will select and save inside DefArc module a jumper data for given element_id\n```\n\n### select_jumper(jumper)\nSelects and saves a table with jumper data inside DefArc module. One need to provide a proper jumper element_id or jumper id or jumper Lua table, otherwise it will save nil.\n\n* **PARAMETER:** `jumper` (string) - an id or element_id of a jumper from Arcweave JSON or Lua table with jumper data (jumper_table)\n\n```\n\tdefarc.select_jumper(\"proper-element_id\") -- will select and save inside DefArc module a jumper data for given element_id\n```\n\n## Jumpers Content:\n\n### get_jumper_element_id([jumper])\nReturns a jumper element_id of selected jumper data. This function returns a proper jumper element_id if proper jumper_id or jumper_element_id is provided and that jumper exists, otherwise it returns a jumper element_id of selected jumper_table.\n\n* **PARAMETER:** `jumper` (string, optional) - an id or element_id of a jumper from Arcweave JSON or Lua table with jumper data (jumper_table)\n* **RETURNS:** `jumper_element_id` (string) - a string with jumper element_id\n\n```\n\tlocal jumper_element_id = defarc.get_jumper_element_id()\n```\n\n## Branches:\n\n### get_branches()\nReturns a table with all branchs of the project.\n\n* **RETURNS:** `branches_table` (table) - a table with data regarding branches of the project\n\n```\n\tlocal branches = defarc.get_branches()\n```\n\n### get_branch_by_id(branch_id)\nReturns a table with selected branch data. One need to provide a proper branch id, otherwise it will return nil.\n\n* **PARAMETER:** `branch_id` (string) - an id of a branch from Arcweave JSON\n* **RETURNS:** `branch_table` (table) - a table with data regarding selected branch\n\n```\n\tlocal branch_table = defarc.get_branch_by_id(\"proper-id\")\n```\n\n### get_branch([branch])\nReturns a table with selected branch data. This function returns a proper branch if proper branch_id is provided, otherwise it returns a selected branch_table.\n\n* **PARAMETER:** `branch` (string, optional) - an id of a branch from Arcweave JSON or Lua table with branch data (branch_table)\n* **RETURNS:** `branch_table` (table) - a table with data regarding selected branch\n\n```\n\tlocal branch_table = defarc.get_branch() -- will return a saved branch, if there is any saved (selected by below functions)\n```\n\n### select_branch_by_id(branch_id)\nSelects and saves a table with branch data inside DefArc module. One need to provide a proper branch id, otherwise it will save nil.\n\n* **PARAMETER:** `branch_id` (string) - an id of a branch from Arcweave JSON\n\n```\n\tdefarc.select_branch_by_id(\"proper-id\") -- will select and save inside DefArc module a branch data for given id\n```\n\n### select_branch(branch)\nSelects and saves a table with branch data inside DefArc module. One need to provide a proper branch id or branch Lua table, otherwise it will save nil.\n\n* **PARAMETER:** `branch` (string) - an id of a branch from Arcweave JSON or Lua table with branch data (branch_table)\n\n```\n\tdefarc.select_branch(\"proper-name\") -- will select and save inside DefArc module a branch data for given name\n```\n\n## Branch Content:\n\n### get_branch_theme([branch])\nReturns a branch theme of selected branch data. This function returns a proper branch theme if proper branch_id is provided, otherwise it returns a branch theme of selected branch_table.\n\n* **PARAMETER:** `branch` (string, optional) - an id of a branch from Arcweave JSON or Lua table with branch data (branch_table)\n* **RETURNS:** `theme` (string) - a string with branch theme, e.g. \"default\"\n\n```\n\tlocal branch_theme = defarc.get_branch_theme()\n```\n\n### get_branch_conditions([branch])\nReturns a branch conditions of selected branch data. This function returns a proper branch conditions if proper branch_id is provided, otherwise it returns a branch conditions of selected branch_table.\n\n* **PARAMETER:** `branch` (string, optional) - an id of a branch from Arcweave JSON or Lua table with branch data (branch_table)\n* **RETURNS:** `conditions` (table) - a table with branch conditions (if, elseifs, else)\n\n```\n\tlocal branch_conditions = defarc.get_branch_conditions()\n```\n\n### get_branch_if_condition([branch])\nReturns a branch if_condition of selected branch data. This function returns a proper branch if_condition if proper branch_id is provided, otherwise it returns a branch if_condition of selected branch_table.\n\n* **PARAMETER:** `branch` (string, optional) - an id of a branch from Arcweave JSON or Lua table with branch data (branch_table)\n* **RETURNS:** `if_condition` (string) - a string with branch if_condition id\n\n```\n\tlocal branch_if_condition_id = defarc.get_branch_if_condition()\n```\n\n### get_branch_elseif_conditions([branch])\nReturns a branch elseif_conditions of selected branch data. This function returns a proper branch elseif_conditions if proper branch_id is provided, otherwise it returns a branch elseif_conditions of selected branch_table.\n\n* **PARAMETER:** `branch` (string, optional) - an id of a branch from Arcweave JSON or Lua table with branch data (branch_table)\n* **RETURNS:** `elseif_conditions` (table) - a table with branch elseif_conditions ids\n\n```\n\tlocal branch_elseif_conditions = defarc.get_branch_elseif_conditions()\n```\n\n### get_branch_else_condition([branch])\nReturns a branch else_condition of selected branch data. This function returns a proper branch else_condition if proper branch_id is provided, otherwise it returns a branch else_condition of selected branch_table.\n\n* **PARAMETER:** `branch` (string, optional) - an id of a branch from Arcweave JSON or Lua table with branch data (branch_table)\n* **RETURNS:** `else_condition` (string) - a string with branch else_condition id\n\n```\n\tlocal branch_else_condition_id = defarc.get_branch_else_condition()\n```\n\n## String helper functions:\n\n### split(inputstr, sep, [alt_sep])\nSplits an input string by a given separator. This function returns a table with strings splitted from input string, if there are any separators in the string, otherwise the table is empty.\n\n* **PARAMETER:** `inputstr` (string) - an input string\n* **PARAMETER:** `sep` (string) - a separator\n* **PARAMETER:** `alt_sep` (string, optional) - additional, alternative separator, for example, when you want to separate by bot \"\u003c\" and \"\u003e\" separators\n* **RETURNS:** `splitted_table` (table) - a table with splitted strings\n\n```\n\tlocal splitted_strings = defarc.split(\"Split by space\", \" \") -- will return a table with strings [\"Split\", \"by\", \"space\"]\n```\n\n### substr_start_end(inputstr, [start_offset], [end_offset])\nCuts off signs from beginning to start_offset and from end to end_offset of the given input string and returns such substring\n\n* **PARAMETER:** `inputstr` (string) - an input string\n* **PARAMETER:** `start_offset` (number) - a number of first signs to cut off from the string, if not given default is 0\n* **PARAMETER:** `end_offset` (number) - a number of last signs to cut off from the string, if not given default is 0\n* **RETURNS:** `substring` (string) - a substring with first and last signs cut off\n\n```\n\tlocal splitted_strings = defarc.substr_start_end(\"Split by space\", \" \") -- will return a table with strings [\"Split\", \"by\", \"space\"]\n```\n\n## Conditions:\n\n### get_conditions()\nReturns a table with all conditions of the project. If there are no conditions in the project returns nil.\n\n* **RETURNS:** `conditions_table` (table) - a table with data regarding conditions of the project\n\n```\n\tlocal conditions = defarc.get_conditions()\n```\n\n### get_condition_by_id(condition_id)\nReturns a table with selected condition data. One need to provide a proper condition id, otherwise it will return nil.\n\n* **PARAMETER:** `condition_id` (string) - an id of a condition from Arcweave JSON\n* **RETURNS:** `condition_table` (table) - a table with data regarding selected condition\n\n```\n\tlocal condition_table = defarc.get_condition_by_id(\"proper-id\")\n```\n\n### get_condition([condition])\nReturns a table with selected condition data. This function returns a proper condition if proper condition_id is provided, otherwise it returns a selected condition_table.\n\n* **PARAMETER:** `condition` (string, optional) - an id of a condition from Arcweave JSON or Lua table with condition data (condition_table)\n* **RETURNS:** `condition_table` (table) - a table with data regarding selected condition\n\n```\n\tlocal condition_table = defarc.get_condition() -- will return a saved condition, if there is any saved (selected by below functions)\n```\n\n### select_condition_by_id(condition_id)\nSelects and saves a table with condition data inside DefArc module. One need to provide a proper condition id, otherwise it will save nil.\n\n* **PARAMETER:** `condition_id` (string) - an id of a condition from Arcweave JSON\n\n```\n\tdefarc.select_condition_by_id(\"proper-id\") -- will select and save inside DefArc module a condition data for given id\n```\n\n### select_condition(condition)\nSelects and saves a table with condition data inside DefArc module. One need to provide a proper condition id or condition Lua table, otherwise it will save nil.\n\n* **PARAMETER:** `condition` (string) - an id of a condition from Arcweave JSON or Lua table with condition data (condition_table)\n\n```\n\tdefarc.select_condition(\"proper-name\") -- will select and save inside DefArc module a condition data for given name\n```\n\n## Condition Content:\n\n### get_condition_output([condition])\nReturns a condition output of selected condition data. This function returns a proper condition output if proper condition_id is provided, otherwise it returns a condition output of selected condition_table.\n\n* **PARAMETER:** `condition` (string, optional) - an id of a condition from Arcweave JSON or Lua table with condition data (condition_table)\n* **RETURNS:** `output` (string) - a string with connection_id linking to another element, viable if condition is met\n\n```\n\tlocal connection_to_element_if_quest_completed = defarc.get_condition_output(\"some-condition-id\")\n```\n\n### get_condition_script([condition])\nReturns a condition script of selected condition data. This function returns a proper condition script if proper condition_id is provided, otherwise it returns a condition script of selected condition_table.\n\n* **PARAMETER:** `condition` (string, optional) - an id of a condition from Arcweave JSON or Lua table with condition data (condition_table)\n* **RETURNS:** `script` (string) - a string with a script from Arcweave, that could be translated and parsed in Lua to check if condition is met\n\n```\n\tlocal script_to_check_condition = defarc.get_condition_script(\"some-condition-id\")\n```\n\n## Parsing Conditions:\n\n### parse_variable_value(global_variable)\nParses a given variable and saves it inside DefArc. Returns saved variable name.\n\n* **PARAMETER:** `global_variable` (string) - a proper global variable name, if not yet exisiting in ArcWeave JSON, DefArc will save it inside for the first time\n* **RETURNS:** `saved_variable` (string) - a string with a saved variable name\n\n```\n\tlocal saved_variable = defarc.parse_variable_value(\"quest_1_completed\")\n```\n\n### check_condition([condition])\nParses a given condition and check it in Lua. Returns true, if condition is met.\n\n* **PARAMETER:** `condition` (string, optional) - an id of a condition from Arcweave JSON or Lua table with condition data (condition_table)\n* **RETURNS:** `result` (boolean) - true if condition is met, false otherwise\n\n```\n\tlocal is_quest_completed = defarc.check_condition(\"some-condition-id\")\n```\n\n## Starting Element:\n\n### get_starting_element_id()\nReturns a starting element id of the project. Set by Play Mode Start in Arcweave.\n\n* **RETURNS:** `element_id` (string) - a starting element id of the project\n\n```\n\tlocal starting_element_id = defarc.get_starting_element_id()\n```\n\n### get_starting_element()\nReturns a starting element table of the project. Set by Play Mode Start in Arcweave.\n\n* **RETURNS:** `element_table` (table) - an element table of the starting element of the project\n\n```\n\tlocal starting_element_table = defarc.get_starting_element()\n```\n\n## Elements:\n\n### get_elements()\nReturns a table with all elements of the project.\n\n* **RETURNS:** `elements_table` (table) - a table with data regarding elements of the project\n\n```\n\tlocal elements = defarc.get_elements()\n```\n\n### get_elements_titles()\nReturns a table with all elements titles of the project.\n\n* **RETURNS:** `elements_titles_table` (table) - a table where for each key (which is a *element_id*), value is an element title\n\n```\n\tlocal elements_titles = defarc.get_elements_titles()\n```\n\n### get_element_by_id(element_id)\nReturns a table with selected element data. One need to provide a proper element id, otherwise it will return nil.\n\n* **PARAMETER:** `element_id` (string) - an id of an element from Arcweave JSON\n* **RETURNS:** `element_table` (table) - a table with data regarding selected element\n\n```\n\tlocal element_table = defarc.get_element_by_id(\"proper-id\")\n```\n\n### get_element_by_title(element_title)\nReturns a table with selected element data. One need to provide a proper element title, otherwise it will return nil.\n\n* **PARAMETER:** `element_title` (string) - a title of an element from Arcweave JSON\n* **RETURNS:** `element_table` (table) - a table with data regarding selected element\n\n```\n\tlocal element_table = defarc.get_element_by_title(\"proper-element-title\")\n```\n\n### get_element([element])\nReturns a table with selected element data. This function returns a proper element if proper element_id or element_title is provided, otherwise it returns a selected element_table.\n\n* **PARAMETER:** `element` (string, optional) - an id or title of an element from Arcweave JSON or Lua table with element data (element_table)\n* **RETURNS:** `element_table` (table) - a table with data regarding selected element\n\n```\n\tlocal element_table = defarc.get_element() -- will return a saved element, if there is any saved (selected by below functions)\n```\n\n### select_element_by_id(element_id)\nSelects and saves a table with element data inside DefArc module. One need to provide a proper element id, otherwise it will save nil.\n\n* **PARAMETER:** `element_id` (string) - an id of an element from Arcweave JSON\n\n```\n\tdefarc.select_element_by_id(\"proper-id\") -- will select and save inside DefArc module an element data for given id\n```\n\n### select_element_by_title(element_title)\nSelects and saves a table with element data inside DefArc module. One need to provide a proper element title, otherwise it will save nil.\n\n* **PARAMETER:** `element_title` (string) - a title of an element from Arcweave JSON\n\n```\n\tdefarc.select_element_by_title(\"proper-element-title\") -- will select and save inside DefArc module an element data for given title\n```\n\n### select_element(element)\nSelects and saves a table with element data inside DefArc module. One need to provide a proper element title or element id or element Lua table, otherwise it will save nil.\n\n* **PARAMETER:** `element` (string) - an id or title of an element from Arcweave JSON or Lua table with element data (element_table)\n\n```\n\tdefarc.select_element(\"proper-element-title\") -- will select and save inside DefArc module an element data for given title\n```\n\n## Element Content:\n\n### get_element_title([element])\nReturns an element title of selected element data. This function returns a proper element title if proper element_id or element_title is provided, otherwise it returns an element title of selected element_table.\n\n* **PARAMETER:** `element` (string, optional) - an id or title of an element from Arcweave JSON or Lua table with element data (element_table)\n* **RETURNS:** `element_title` (string) - a string with element title\n\n```\n\tlocal element_title = defarc.get_element_title()\n```\n\n### get_element_theme([element])\nReturns an element theme of selected element data. This function returns a proper element theme if proper element_id or element_title is provided, otherwise it returns an element theme of selected element_table.\n\n* **PARAMETER:** `element` (string, optional) - an id or title of an element from Arcweave JSON or Lua table with element data (element_table)\n* **RETURNS:** `element_theme` (string) - a string with element theme, e.g \"gold\", \"red\"\n\n```\n\tlocal element_theme = defarc.get_element_theme()\n```\n\n### get_element_content([element])\nReturns an element content of selected element data. This function returns a proper element content if proper element_id or element_title is provided, otherwise it returns an element content of selected element_table.\n\n* **PARAMETER:** `element` (string, optional) - an id or title of an element from Arcweave JSON or Lua table with element data (element_table)\n* **RETURNS:** `element_content` (string) - a string with element content (or element text), cut off of first and last paragraph markers\n\n```\n\tlocal text_to_say = defarc.get_element_content()\n```\n\n\n### get_element_content([element])\nReturns an element content of selected element data. This function returns a proper element content if proper element_id or element_title is provided, otherwise it returns an element content of selected element_table.\n\n* **PARAMETER:** `element` (string, optional) - an id or theme of an element from Arcweave JSON or Lua table with element data (element_table)\n* **RETURNS:** `element_content` (string) - a string with element content (or element text), cut off of first and last paragraph markers\n\n```\n\tlocal text_to_say = defarc.get_element_content()\n```\n\n### get_element_outputs([element])\nReturns a table with element outputs of selected element data. This function returns a proper element outputs if proper element_id or element_title is provided, otherwise it returns an element outputs of selected element_table.\n\n* **PARAMETER:** `element` (string, optional) - an id or title of an element from Arcweave JSON or Lua table with element data (element_table)\n* **RETURNS:** `element_outputs` (table) - a table with element outputs - outputs are connection_ids\n\n```\n\tlocal connection_ids = defarc.get_element_outputs()\n```\n\n### get_element_assets([element])\nReturns a table with element assets of selected element data. This function returns a proper element assets if proper element_id or element_title is provided, otherwise it returns false.\n\n* **PARAMETER:** `element` (string, optional) - an id or title of an element from Arcweave JSON or Lua table with element data (element_table)\n* **RETURNS:** `element_outputs` (table) - a table with element assets\n\n```\n\tlocal assets = defarc.get_element_assets()\n```\n\n### get_element_components([element])\nReturns a table with element components of selected element data. This function returns a proper element components if proper element_id or element_title is provided, otherwise it returns an element components of selected element_table.\n\n* **PARAMETER:** `element` (string, optional) - an id or title of an element from Arcweave JSON or Lua table with element data (element_table)\n* **RETURNS:** `element_components` (table) - a table with element components ids\n\n```\n\tlocal connection_ids = defarc.get_element_components()\n```\n\n### get_element_linked_board([element])\nReturns a linked_board id of selected element data. This function returns a proper element linked_board if proper element_id or element_title is provided, otherwise it returns an element linked_board of selected element_table.\n\n* **PARAMETER:** `element` (string, optional) - an id or title of an element from Arcweave JSON or Lua table with element data (element_table)\n* **RETURNS:** `element_linked_board` (string) - a linked_board id\n\n```\n\tlocal linked_board_id = defarc.get_element_linked_board()\n```\n## Connections:\n\n### get_connections()\nReturns a table with all connections of the project.\n\n* **RETURNS:** `connections_table` (table) - a table with data regarding connections of the project, where for each key (connection_id), value is a table with connection data\n\n```\n\tlocal connections = defarc.get_connections()\n```\n\n### get_connections_for_source_id(source_id)\nReturns a table with all connections of the project for given source_id.\n\n* **PARAMETER:** `source_id` (string) - a source id for which connections should be returned\n* **RETURNS:** `connections_table` (table) - a table with data regarding connections of the project\n\n```\n\tlocal connections_for_source_id = defarc.get_connections_for_source_id(\"proper-source-id\")\n```\n\n### get_connection_by_id(connection_id)\nReturns a table with selected connection data. One need to provide a proper connection id, otherwise it will return nil.\n\n* **PARAMETER:** `connection_id` (string) - an id of a connection from Arcweave JSON\n* **RETURNS:** `connection_table` (table) - a table with data regarding selected connection, where for each key (connection_id), value is a table with connection data\n\n```\n\tlocal connection_table = defarc.get_connection_by_id(\"proper-id\")\n```\n\n### get_connection([connection])\nReturns a table with selected connection data. This function returns a proper connection if proper connection_id is provided, otherwise it returns a selected connection_table.\n\n* **PARAMETER:** `connection` (string, optional) - an id of a connection from Arcweave JSON or Lua table with connection data (connection_table)\n* **RETURNS:** `connection_table` (table) - a table with data regarding selected connection\n\n```\n\tlocal connection_table = defarc.get_connection() -- will return a saved connection, if there is any saved (selected by below functions)\n```\n\n### select_connection_by_id(connection_id)\nSelects and saves a table with connection data inside DefArc module. One need to provide a proper connection id, otherwise it will save nil.\n\n* **PARAMETER:** `connection_id` (string) - an id of a connection from Arcweave JSON\n\n```\n\tdefarc.select_connection_by_id(\"proper-id\") -- will select and save inside DefArc module a connection data for given id\n```\n\n### select_connection(connection)\nSelects and saves a table with connection data inside DefArc module. One need to provide a proper connection id or connection Lua table, otherwise it will save nil.\n\n* **PARAMETER:** `connection` (string) - an id of a connection from Arcweave JSON or Lua table with connection data (connection_table)\n\n```\n\tdefarc.select_connection(\"proper-name\") -- will select and save inside DefArc module a connection data for given name\n```\n\n## Connection Content:\n\n### get_connection_type([connection])\nReturns a connection type of selected connection data. This function returns a proper connection type if proper connection_id is provided, otherwise it returns a connection type of selected connection_table.\n\n* **PARAMETER:** `connection` (string, optional) - an id of a connection from Arcweave JSON or Lua table with connection data (connection_table)\n* **RETURNS:** `type` (string) - a string with connection type, e.g. \"Straight\", \"Flowchart\"\n\n```\n\tlocal connection_type = defarc.get_connection_type()\n```\n\n### get_connection_label([connection])\nReturns a connection label of selected connection data. This function returns a proper connection label if proper connection_id is provided, otherwise it returns a connection label of selected connection_table.\n\n* **PARAMETER:** `connection` (string, optional) - an id of a connection from Arcweave JSON or Lua table with connection data (connection_table)\n* **RETURNS:** `label` (string) - a string with connection label, stripped of beginning and ending paragraph tags. Label could be used as an option to display to players.\n\n```\n\tlocal option_to_display = defarc.get_connection_label()\n```\n\n### get_connection_theme([connection])\nReturns a connection theme of selected connection data. This function returns a proper connection theme if proper connection_id is provided, otherwise it returns a connection theme of selected connection_table.\n\n* **PARAMETER:** `connection` (string, optional) - an id of a connection from Arcweave JSON or Lua table with connection data (connection_table)\n* **RETURNS:** `theme` (string) - a string with connection theme, e.g. \"default\"\n\n```\n\tlocal connection_theme = defarc.get_connection_theme()\n```\n\n### get_connection_source_id([connection])\nReturns a connection source_id of selected connection data. This function returns a proper connection source_id if proper connection_id is provided, otherwise it returns a connection source_id of selected connection_table.\n\n* **PARAMETER:** `connection` (string, optional) - an id of a connection from Arcweave JSON or Lua table with connection data (connection_table)\n* **RETURNS:** `source_id` (string) - a string with connection source_id, which is an element from which the connection is starting\n\n```\n\tlocal connection_source_id = defarc.get_connection_source_id()\n```\n\n### get_connection_target_id([connection])\nReturns a connection target_id of selected connection data. This function returns a proper connection target_id if proper connection_id is provided, otherwise it returns a connection target_id of selected connection_table.\n\n* **PARAMETER:** `connection` (string, optional) - an id of a connection from Arcweave JSON or Lua table with connection data (connection_table)\n* **RETURNS:** `target_id` (string) - a string with connection target_id, which is an element to which the connection is joined\n\n```\n\tlocal connection_target_id = defarc.get_connection_target_id()\n```\n\n### get_connection_source_type([connection])\nReturns a connection source_type of selected connection data. This function returns a proper connection source_type if proper connection_id is provided, otherwise it returns a connection source_type of selected connection_table.\n\n* **PARAMETER:** `connection` (string, optional) - an id of a connection from Arcweave JSON or Lua table with connection data (connection_table)\n* **RETURNS:** `source_type` (string) - a string with connection source_type, e.g. \"conditions\" or \"elements\"\n\n```\n\tlocal connection_source_type = defarc.get_connection_source_type()\n```\n\n### get_connection_target_type([connection])\nReturns a connection target_type of selected connection data. This function returns a proper connection target_type if proper connection_id is provided, otherwise it returns a connection target_type of selected connection_table.\n\n* **PARAMETER:** `connection` (string, optional) - an id of a connection from Arcweave JSON or Lua table with connection data (connection_table)\n* **RETURNS:** `target_type` (string) - a string with connection target_type, e.g. \"branches\" or \"elements\"\n\n```\n\tlocal connection_target_type = defarc.get_connection_target_type()\n```\n\n---","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaweljarosz%2Fdefarc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaweljarosz%2Fdefarc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaweljarosz%2Fdefarc/lists"}