aboutsummaryrefslogtreecommitdiff
path: root/Lua
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-09-26 14:23:24 -0700
committerBruce Hill <bruce@bruce-hill.com>2021-09-26 14:23:24 -0700
commit6b29503e9583f1a598c1fb9d6617d422a7e4f7be (patch)
tree244afa519f3d230fe150e598e33292141f7f4a0b /Lua
parent9983e2444a60571a93eb149feaf1da3a8d0455de (diff)
Added :getsource() method
Diffstat (limited to 'Lua')
-rw-r--r--Lua/lbp.c7
1 files changed, 7 insertions, 0 deletions
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}
};