summaryrefslogtreecommitdiff
path: root/lib/frrlua.h
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2024-08-28 17:08:45 +0300
committerDonatas Abraitis <donatas@opensourcerouting.org>2024-08-28 17:08:45 +0300
commita0a2a35ed30938f99715cced352a3fd6f89d82dd (patch)
treea0da346fcc2cfc348bd36ce2c5a1b558bf80982d /lib/frrlua.h
parentb1012b693fcfed29a05d99e8bea623902223dc7b (diff)
lib: Add a helper function to dump Lua stack
Very handy for debugging. In Lua script just use "log.trace(table)": ``` function on_rib_process_dplane_results(ctx) log.trace(ctx.rinfo.zd_ng) end ``` You will get something like: ``` Aug 28 17:04:36 donatas-laptop zebra[3782199]: [GCZ7N-MM9D9] { 1: { type: 2 weight: 1 flags: 5 backup_idx: 0 vrf_id: 0 nh_encap_type: 0 gate: { value: 5.87967e+08 string: "192.168.11.35" } nh_label_type: 0 srte_color: 0 ifindex: 0 backup_num: 0 } 2: { type: 3 weight: 1 flags: 3 backup_idx: 0 vrf_id: 0 nh_encap_type: 0 nh_label_type: 0 srte_color: 0 ifindex: 4 backup_num: 0 } } ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'lib/frrlua.h')
-rw-r--r--lib/frrlua.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/frrlua.h b/lib/frrlua.h
index dc0f4d9986..e407a4492f 100644
--- a/lib/frrlua.h
+++ b/lib/frrlua.h
@@ -181,6 +181,9 @@ int frrlua_table_get_integer(lua_State *L, const char *key);
*/
void frrlua_export_logging(lua_State *L);
+/* A helper fuction that dumps the Lua stack */
+void lua_table_dump(lua_State *L, int index, struct buffer *buf, int level);
+
/*
* Dump Lua stack to a string.
*