/* Blob methods */
LUA_FUNCTION_DEF (text, len);
LUA_FUNCTION_DEF (text, str);
+LUA_FUNCTION_DEF (text, ptr);
static const struct luaL_reg textlib_m[] = {
LUA_INTERFACE_DEF (text, len),
LUA_INTERFACE_DEF (text, str),
+ LUA_INTERFACE_DEF (text, ptr),
{"__tostring", lua_text_str},
{NULL, NULL}
};
return 1;
}
+static gint
+lua_text_ptr (lua_State *L)
+{
+ struct rspamd_lua_text *t = lua_check_text (L, 1);
+
+ if (t != NULL) {
+ lua_pushlightuserdata (L, (gpointer)t->start);
+ }
+ else {
+ lua_pushnil (L);
+ }
+
+ return 1;
+}
+
/* Init part */
static gint