aboutsummaryrefslogtreecommitdiff
path: root/ldblib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-04-04 11:45:26 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-04-04 11:45:26 -0300
commit5ca1075b714e825006e8ba4f8e7ea5544879bb41 (patch)
treead085afa58f29e8e96071ae88c1e6e1dd73e0750 /ldblib.c
parent38425e069243fe6d991f2e99b4bba192af3563c7 (diff)
downloadlua-5ca1075b714e825006e8ba4f8e7ea5544879bb41.tar.gz
lua-5ca1075b714e825006e8ba4f8e7ea5544879bb41.tar.bz2
lua-5ca1075b714e825006e8ba4f8e7ea5544879bb41.zip
Added field 'srclen' to structure 'lua_Debug'
This new field gets the length of 'source' in the same structure. Unlike the other strings in that structure, 'source' can be relatively large, and Lua already has its length readily available.
Diffstat (limited to 'ldblib.c')
-rw-r--r--ldblib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ldblib.c b/ldblib.c
index ada35250..d045a82e 100644
--- a/ldblib.c
+++ b/ldblib.c
@@ -167,7 +167,8 @@ static int db_getinfo (lua_State *L) {
167 return luaL_argerror(L, arg+2, "invalid option"); 167 return luaL_argerror(L, arg+2, "invalid option");
168 lua_newtable(L); /* table to collect results */ 168 lua_newtable(L); /* table to collect results */
169 if (strchr(options, 'S')) { 169 if (strchr(options, 'S')) {
170 settabss(L, "source", ar.source); 170 lua_pushlstring(L, ar.source, ar.srclen);
171 lua_setfield(L, -2, "source");
171 settabss(L, "short_src", ar.short_src); 172 settabss(L, "short_src", ar.short_src);
172 settabsi(L, "linedefined", ar.linedefined); 173 settabsi(L, "linedefined", ar.linedefined);
173 settabsi(L, "lastlinedefined", ar.lastlinedefined); 174 settabsi(L, "lastlinedefined", ar.lastlinedefined);