# Menu References & Flags

### Menu References

Simply used as a table to store references in your menu, ones you may want to access globally.

```lua
lib["menu_references"]["void_hide"] = example_section:create_element({["name"] = "void hide"}, {
    ["toggle"] = {["flag"] = "!void_hide", ["default"] = false}
})
```

You may now access this element anywhere in your codebase, no need to define a local above your code block. In the UI this is used for notifications, hide on load, and config list.

### Flags

Flags are used to get the value of whatever element you have and should be more commonly used than menu references. As you can see even in the example for menu references we called a flag. Flags are good to be used when trying to access a variable.

```lua
local void_hide = example_section:create_element({["name"] = "void hide"}, {
    ["toggle"] = {["flag"] = "!void_hide", ["default"] = false}
})

print(tostring(lib["flags"]["!void_hide"])) -- false

void_hide:set_toggle(true)

print(tostring(lib["flags"]["!void_hide"])) -- true
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://panduh.gitbook.io/panduh-docs/getting-started/menu-references-and-flags.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
