From 6b29503e9583f1a598c1fb9d6617d422a7e4f7be Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 26 Sep 2021 14:23:24 -0700 Subject: Added :getsource() method --- Lua/lbp.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Lua/lbp.c') diff --git a/Lua/lbp.c b/Lua/lbp.c index c90e5a7..1ef7684 100644 --- a/Lua/lbp.c +++ b/Lua/lbp.c @@ -223,6 +223,12 @@ static int Lmatch_tostring(lua_State *L) return 1; } +static int Lpat_source(lua_State *L) +{ + lua_getiuservalue(L, 1, 1); + return 1; +} + static int Lpat_tostring(lua_State *L) { luaL_Buffer b; @@ -252,6 +258,7 @@ static const luaL_Reg pat_methods[] = { {"match", Lmatch}, {"replace", Lreplace}, {"matches", Lmatches}, + {"getsource", Lpat_source}, {NULL, NULL} }; -- cgit v1.2.3