diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-09-24 13:13:50 +0300 |
|---|---|---|
| committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-09-24 13:13:50 +0300 |
| commit | 4b0f4f96ac8aa714c5fdd576d11f31156cc42543 (patch) | |
| tree | afb951ae623cc155e211d59ff3337299be4284a5 /lib/frrscript.c | |
| parent | 74542e1fc149a17eeddd8a9808110967ad52c888 (diff) | |
lib: Load built-in Lua functions
We can't use even `string()` function because built-in functions are not
loaded.
Testing with:
```
$ cat /etc/frr/scripts/zebra.lua
function on_rib_process_dplane_results(ctx)
log.warn(string.upper("testas"))
return {}
end
```
This results to "TESTAS" in the logs.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'lib/frrscript.c')
| -rw-r--r-- | lib/frrscript.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/frrscript.c b/lib/frrscript.c index acdd1df67b..dbae31b666 100644 --- a/lib/frrscript.c +++ b/lib/frrscript.c @@ -348,6 +348,9 @@ int frrscript_load(struct frrscript *fs, const char *function_name, /* Set up the Lua script */ lua_State *L = luaL_newstate(); + /* Load basic built-in Lua functions, e.g. ipairs, string, etc. */ + luaL_openlibs(L); + frrlua_export_logging(L); char script_name[MAXPATHLEN]; |
