/*
* Setup the prefix information to pass in
*/
- frrlua_newtable_prefix(L, prefix);
+ lua_pushprefix(L, prefix);
/*
* Setup the bgp_path_info information
*/
* stack easier.
*/
-const char *frrlua_table_get_string(lua_State *L, const char *key)
-{
- const char *str;
-
- lua_pushstring(L, key);
- lua_gettable(L, -2);
-
- str = (const char *)lua_tostring(L, -1);
- lua_pop(L, 1);
-
- return str;
-}
-
int frrlua_table_get_integer(lua_State *L, const char *key)
{
int result;
* datatypes.
*/
-int frrlua_newtable_prefix(lua_State *L, const struct prefix *prefix)
+int lua_pushprefix(lua_State *L, const struct prefix *prefix)
{
char buffer[100];
return 0;
}
-int frrlua_newtable_interface(lua_State *L, const struct interface *ifp)
+int lua_pushinterface(lua_State *L, const struct interface *ifp)
{
zlog_debug("frrlua: pushing interface table");
#if defined(HAVE_LUA)
-#include "lua.h"
-#include "lualib.h"
-#include "lauxlib.h"
+#include <lua.h>
+#include <lualib.h>
+#include <lauxlib.h>
#include "prefix.h"
#include "frrscript.h"
/*
* Pushes a new table containing relevant fields from a prefix structure.
- *
- * Additionally sets the global variable "prefix" to point at this table.
*/
-int frrlua_newtable_prefix(lua_State *L, const struct prefix *prefix);
+int lua_pushprefix(lua_State *L, const struct prefix *prefix);
/*
* Pushes a new table containing relevant fields from an interface structure.
*/
-int frrlua_newtable_interface(lua_State *L, const struct interface *ifp);
+int lua_pushinterface(lua_State *L, const struct interface *ifp);
/*
* Retrieve a string from table on the top of the stack.
"Lua type encoders");
/* Register core library types */
- frrscript_register_type_encoder("prefix",
- (encoder_func)frrlua_newtable_prefix);
- frrscript_register_type_encoder(
- "interface", (encoder_func)frrlua_newtable_interface);
+ frrscript_register_type_encoder("prefix", (encoder_func)lua_pushprefix);
+ frrscript_register_type_encoder("interface",
+ (encoder_func)lua_pushinterface);
}
#ifndef __FRRSCRIPT_H__
#define __FRRSCRIPT_H__
+#include <lua.h>
#include "frrlua.h"
#ifdef __cplusplus
#define FRRSCRIPT_PATH "/etc/frr/scripts"
-typedef int (*encoder_func)(struct lua_State *, const void *);
+typedef int (*encoder_func)(lua_State *, const void *);
struct frrscript {
/* Script name */