aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-05-18 11:43:43 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-05-18 11:43:43 -0300
commitabbae57c7844b1121e7251d56f681394f20c1821 (patch)
tree823201f4d2631fcae027117681553de80b2c96f0
parentf2c1531e6cacb10926158d8def5fa5841a0f357e (diff)
downloadlua-abbae57c7844b1121e7251d56f681394f20c1821.tar.gz
lua-abbae57c7844b1121e7251d56f681394f20c1821.tar.bz2
lua-abbae57c7844b1121e7251d56f681394f20c1821.zip
Variable attributes can prefix name list
In this format, the attribute applies to all names in the list; e.g. "global<const> print, require, math".
-rw-r--r--lparser.c53
-rw-r--r--manual/manual.of30
-rwxr-xr-xtestes/all.lua2
-rw-r--r--testes/calls.lua2
-rw-r--r--testes/closure.lua2
-rw-r--r--testes/code.lua2
-rw-r--r--testes/files.lua2
-rw-r--r--testes/goto.lua12
-rw-r--r--testes/literals.lua2
-rw-r--r--testes/locals.lua22
-rw-r--r--testes/math.lua7
-rw-r--r--testes/nextvar.lua2
-rw-r--r--testes/pm.lua2
-rw-r--r--testes/strings.lua2
-rw-r--r--testes/utf8.lua2
15 files changed, 84 insertions, 60 deletions
diff --git a/lparser.c b/lparser.c
index 384ef690..bad3592a 100644
--- a/lparser.c
+++ b/lparser.c
@@ -1733,7 +1733,7 @@ static void localfunc (LexState *ls) {
1733} 1733}
1734 1734
1735 1735
1736static lu_byte getvarattribute (LexState *ls) { 1736static lu_byte getvarattribute (LexState *ls, lu_byte df) {
1737 /* attrib -> ['<' NAME '>'] */ 1737 /* attrib -> ['<' NAME '>'] */
1738 if (testnext(ls, '<')) { 1738 if (testnext(ls, '<')) {
1739 TString *ts = str_checkname(ls); 1739 TString *ts = str_checkname(ls);
@@ -1746,7 +1746,7 @@ static lu_byte getvarattribute (LexState *ls) {
1746 else 1746 else
1747 luaK_semerror(ls, "unknown attribute '%s'", attr); 1747 luaK_semerror(ls, "unknown attribute '%s'", attr);
1748 } 1748 }
1749 return VDKREG; /* regular variable */ 1749 return df; /* return default value */
1750} 1750}
1751 1751
1752 1752
@@ -1767,10 +1767,12 @@ static void localstat (LexState *ls) {
1767 int nvars = 0; 1767 int nvars = 0;
1768 int nexps; 1768 int nexps;
1769 expdesc e; 1769 expdesc e;
1770 do { 1770 /* get prefixed attribute (if any); default is regular local variable */
1771 TString *vname = str_checkname(ls); 1771 lu_byte defkind = getvarattribute(ls, VDKREG);
1772 lu_byte kind = getvarattribute(ls); 1772 do { /* for each variable */
1773 vidx = new_varkind(ls, vname, kind); 1773 TString *vname = str_checkname(ls); /* get its name */
1774 lu_byte kind = getvarattribute(ls, defkind); /* postfixed attribute */
1775 vidx = new_varkind(ls, vname, kind); /* predeclare it */
1774 if (kind == RDKTOCLOSE) { /* to-be-closed? */ 1776 if (kind == RDKTOCLOSE) { /* to-be-closed? */
1775 if (toclose != -1) /* one already present? */ 1777 if (toclose != -1) /* one already present? */
1776 luaK_semerror(ls, "multiple to-be-closed variables in local list"); 1778 luaK_semerror(ls, "multiple to-be-closed variables in local list");
@@ -1778,13 +1780,13 @@ static void localstat (LexState *ls) {
1778 } 1780 }
1779 nvars++; 1781 nvars++;
1780 } while (testnext(ls, ',')); 1782 } while (testnext(ls, ','));
1781 if (testnext(ls, '=')) 1783 if (testnext(ls, '=')) /* initialization? */
1782 nexps = explist(ls, &e); 1784 nexps = explist(ls, &e);
1783 else { 1785 else {
1784 e.k = VVOID; 1786 e.k = VVOID;
1785 nexps = 0; 1787 nexps = 0;
1786 } 1788 }
1787 var = getlocalvardesc(fs, vidx); /* get last variable */ 1789 var = getlocalvardesc(fs, vidx); /* retrieve last variable */
1788 if (nvars == nexps && /* no adjustments? */ 1790 if (nvars == nexps && /* no adjustments? */
1789 var->vd.kind == RDKCONST && /* last variable is const? */ 1791 var->vd.kind == RDKCONST && /* last variable is const? */
1790 luaK_exp2const(fs, &e, &var->k)) { /* compile-time constant? */ 1792 luaK_exp2const(fs, &e, &var->k)) { /* compile-time constant? */
@@ -1800,29 +1802,35 @@ static void localstat (LexState *ls) {
1800} 1802}
1801 1803
1802 1804
1803static lu_byte getglobalattribute (LexState *ls) { 1805static lu_byte getglobalattribute (LexState *ls, lu_byte df) {
1804 lu_byte kind = getvarattribute(ls); 1806 lu_byte kind = getvarattribute(ls, df);
1805 if (kind == RDKTOCLOSE) 1807 switch (kind) {
1806 luaK_semerror(ls, "global variables cannot be to-be-closed"); 1808 case RDKTOCLOSE:
1807 /* adjust kind for global variable */ 1809 luaK_semerror(ls, "global variables cannot be to-be-closed");
1808 return (kind == VDKREG) ? GDKREG : GDKCONST; 1810 break; /* to avoid warnings */
1811 case RDKCONST:
1812 return GDKCONST; /* adjust kind for global variable */
1813 default:
1814 return kind;
1815 }
1809} 1816}
1810 1817
1811 1818
1812static void globalstat (LexState *ls) { 1819static void globalstat (LexState *ls) {
1813 /* globalstat -> (GLOBAL) '*' attrib 1820 /* globalstat -> (GLOBAL) attrib '*'
1814 globalstat -> (GLOBAL) NAME attrib {',' NAME attrib} */ 1821 globalstat -> (GLOBAL) attrib NAME attrib {',' NAME attrib} */
1815 FuncState *fs = ls->fs; 1822 FuncState *fs = ls->fs;
1823 /* get prefixed attribute (if any); default is regular global variable */
1824 lu_byte defkind = getglobalattribute(ls, GDKREG);
1816 if (testnext(ls, '*')) { 1825 if (testnext(ls, '*')) {
1817 lu_byte kind = getglobalattribute(ls);
1818 /* use NULL as name to represent '*' entries */ 1826 /* use NULL as name to represent '*' entries */
1819 new_varkind(ls, NULL, kind); 1827 new_varkind(ls, NULL, defkind);
1820 fs->nactvar++; /* activate declaration */ 1828 fs->nactvar++; /* activate declaration */
1821 } 1829 }
1822 else { 1830 else {
1823 do { 1831 do { /* list of names */
1824 TString *vname = str_checkname(ls); 1832 TString *vname = str_checkname(ls);
1825 lu_byte kind = getglobalattribute(ls); 1833 lu_byte kind = getglobalattribute(ls, defkind);
1826 new_varkind(ls, vname, kind); 1834 new_varkind(ls, vname, kind);
1827 fs->nactvar++; /* activate declaration */ 1835 fs->nactvar++; /* activate declaration */
1828 } while (testnext(ls, ',')); 1836 } while (testnext(ls, ','));
@@ -2003,8 +2011,9 @@ static void statement (LexState *ls) {
2003 is not reserved */ 2011 is not reserved */
2004 if (ls->t.seminfo.ts == ls->glbn) { /* current = "global"? */ 2012 if (ls->t.seminfo.ts == ls->glbn) { /* current = "global"? */
2005 int lk = luaX_lookahead(ls); 2013 int lk = luaX_lookahead(ls);
2006 if (lk == TK_NAME || lk == '*' || lk == TK_FUNCTION) { 2014 if (lk == '<' || lk == TK_NAME || lk == '*' || lk == TK_FUNCTION) {
2007 /* 'global name' or 'global *' or 'global function' */ 2015 /* 'global <attrib>' or 'global name' or 'global *' or
2016 'global function' */
2008 globalstatfunc(ls, line); 2017 globalstatfunc(ls, line);
2009 break; 2018 break;
2010 } 2019 }
diff --git a/manual/manual.of b/manual/manual.of
index effb95da..eb97e853 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -1651,43 +1651,47 @@ Function calls are explained in @See{functioncall}.
1651Local and global variables can be declared anywhere inside a block. 1651Local and global variables can be declared anywhere inside a block.
1652The declaration for locals can include an initialization: 1652The declaration for locals can include an initialization:
1653@Produc{ 1653@Produc{
1654@producname{stat}@producbody{@Rw{local} attnamelist @bnfopt{@bnfter{=} explist}} 1654@producname{stat}@producbody{@Rw{local}
1655 attnamelist @bnfopt{@bnfter{=} explist}}
1655@producname{stat}@producbody{@Rw{global} attnamelist} 1656@producname{stat}@producbody{@Rw{global} attnamelist}
1656@producname{attnamelist}@producbody{
1657 @bnfNter{Name} @bnfopt{attrib}
1658 @bnfrep{@bnfter{,} @bnfNter{Name} @bnfopt{attrib}}}
1659} 1657}
1660If present, an initial assignment has the same semantics 1658If present, an initial assignment has the same semantics
1661of a multiple assignment @see{assignment}. 1659of a multiple assignment @see{assignment}.
1662Otherwise, all local variables are initialized with @nil. 1660Otherwise, all local variables are initialized with @nil.
1663 1661
1664Each variable name may be postfixed by an attribute 1662The list of names may be prefixed by an attribute
1665(a name between angle brackets): 1663(a name between angle brackets)
1664and each variable name may be postfixed by an attribute:
1666@Produc{ 1665@Produc{
1666@producname{attnamelist}@producbody{
1667 @bnfopt{attrib} @bnfNter{Name} @bnfopt{attrib}
1668 @bnfrep{@bnfter{,} @bnfNter{Name} @bnfopt{attrib}}}
1667@producname{attrib}@producbody{@bnfter{<} @bnfNter{Name} @bnfter{>}} 1669@producname{attrib}@producbody{@bnfter{<} @bnfNter{Name} @bnfter{>}}
1668} 1670}
1671A prefixed attribute applies to all names in the list;
1672a postfixed attribute applies to its particular name.
1669There are two possible attributes: 1673There are two possible attributes:
1670@id{const}, which declares a @emph{constant} or @emph{read-only} variable, 1674@id{const}, which declares a @emph{constant} or @emph{read-only} variable,
1671@index{constant variable} 1675@index{constant variable}
1672that is, a variable that cannot be used as the left-hand side of an 1676that is, a variable that cannot be used as the left-hand side of an
1673assignment, 1677assignment,
1674and @id{close}, which declares a to-be-closed variable @see{to-be-closed}. 1678and @id{close}, which declares a to-be-closed variable @see{to-be-closed}.
1675A list of variables can contain at most one to-be-closed variable.
1676Only local variables can have the @id{close} attribute. 1679Only local variables can have the @id{close} attribute.
1680A list of variables can contain at most one to-be-closed variable.
1677 1681
1678Lua offers also a collective declaration for global variables: 1682Lua offers also a collective declaration for global variables:
1679@Produc{ 1683@Produc{
1680@producname{stat}@producbody{@Rw{global} @bnfter{*} @bnfopt{attrib}} 1684@producname{stat}@producbody{@Rw{global} @bnfopt{attrib} @bnfter{*}}
1681} 1685}
1682This special form implicitly declares 1686This special form implicitly declares
1683as globals all names not explicitly declared previously. 1687as globals all names not explicitly declared previously.
1684In particular, 1688In particular,
1685@T{global * <const>} implicitly declares 1689@T{global<const> *} implicitly declares
1686as read-only globals all names not explicitly declared previously; 1690as read-only globals all names not explicitly declared previously;
1687see the following example: 1691see the following example:
1688@verbatim{ 1692@verbatim{
1689global X 1693global X
1690global * <const> 1694global<const> *
1691print(math.pi) -- Ok, 'print' and 'math' are read-only 1695print(math.pi) -- Ok, 'print' and 'math' are read-only
1692X = 1 -- Ok, declared as read-write 1696X = 1 -- Ok, declared as read-write
1693Y = 1 -- Error, Y is read-only 1697Y = 1 -- Error, Y is read-only
@@ -1700,7 +1704,7 @@ the scope of any other @Rw{global} declaration.
1700Therefore, a program that does not use global declarations 1704Therefore, a program that does not use global declarations
1701or start with @T{global *} 1705or start with @T{global *}
1702has free read-write access to any global; 1706has free read-write access to any global;
1703a program that starts with @T{global * <const>} 1707a program that starts with @T{global<const> *}
1704has free read-only access to any global; 1708has free read-only access to any global;
1705and a program that starts with any other global declaration 1709and a program that starts with any other global declaration
1706(e.g., @T{global none}) can only refer to declared variables. 1710(e.g., @T{global none}) can only refer to declared variables.
@@ -9620,11 +9624,11 @@ and @bnfNter{LiteralString}, see @See{lexical}.)
9620@OrNL @Rw{global} @Rw{function} @bnfNter{Name} funcbody 9624@OrNL @Rw{global} @Rw{function} @bnfNter{Name} funcbody
9621@OrNL @Rw{local} attnamelist @bnfopt{@bnfter{=} explist} 9625@OrNL @Rw{local} attnamelist @bnfopt{@bnfter{=} explist}
9622@OrNL @Rw{global} attnamelist 9626@OrNL @Rw{global} attnamelist
9623@OrNL @Rw{global} @bnfter{*} @bnfopt{attrib} 9627@OrNL @Rw{global} @bnfopt{attrib} @bnfter{*}
9624} 9628}
9625 9629
9626@producname{attnamelist}@producbody{ 9630@producname{attnamelist}@producbody{
9627 @bnfNter{Name} @bnfopt{attrib} 9631 @bnfopt{attrib} @bnfNter{Name} @bnfopt{attrib}
9628 @bnfrep{@bnfter{,} @bnfNter{Name} @bnfopt{attrib}}} 9632 @bnfrep{@bnfter{,} @bnfNter{Name} @bnfopt{attrib}}}
9629 9633
9630@producname{attrib}@producbody{@bnfter{<} @bnfNter{Name} @bnfter{>}} 9634@producname{attrib}@producbody{@bnfter{<} @bnfNter{Name} @bnfter{>}}
diff --git a/testes/all.lua b/testes/all.lua
index 499c100d..d3e2f123 100755
--- a/testes/all.lua
+++ b/testes/all.lua
@@ -2,7 +2,7 @@
2-- $Id: testes/all.lua $ 2-- $Id: testes/all.lua $
3-- See Copyright Notice in file lua.h 3-- See Copyright Notice in file lua.h
4 4
5global * <const> 5global <const> *
6 6
7global _soft, _port, _nomsg 7global _soft, _port, _nomsg
8global T 8global T
diff --git a/testes/calls.lua b/testes/calls.lua
index 0ea1c4ab..21441701 100644
--- a/testes/calls.lua
+++ b/testes/calls.lua
@@ -1,7 +1,7 @@
1-- $Id: testes/calls.lua $ 1-- $Id: testes/calls.lua $
2-- See Copyright Notice in file lua.h 2-- See Copyright Notice in file lua.h
3 3
4global * <const> 4global <const> *
5 5
6print("testing functions and calls") 6print("testing functions and calls")
7 7
diff --git a/testes/closure.lua b/testes/closure.lua
index c55d1583..0c2e96c0 100644
--- a/testes/closure.lua
+++ b/testes/closure.lua
@@ -1,7 +1,7 @@
1-- $Id: testes/closure.lua $ 1-- $Id: testes/closure.lua $
2-- See Copyright Notice in file lua.h 2-- See Copyright Notice in file lua.h
3 3
4global * <const> 4global <const> *
5 5
6print "testing closures" 6print "testing closures"
7 7
diff --git a/testes/code.lua b/testes/code.lua
index b6ceb34c..633f4896 100644
--- a/testes/code.lua
+++ b/testes/code.lua
@@ -1,7 +1,7 @@
1-- $Id: testes/code.lua $ 1-- $Id: testes/code.lua $
2-- See Copyright Notice in file lua.h 2-- See Copyright Notice in file lua.h
3 3
4global * <const> 4global <const> *
5 5
6if T==nil then 6if T==nil then
7 (Message or print)('\n >>> testC not active: skipping opcode tests <<<\n') 7 (Message or print)('\n >>> testC not active: skipping opcode tests <<<\n')
diff --git a/testes/files.lua b/testes/files.lua
index c2b355fb..d4e327b7 100644
--- a/testes/files.lua
+++ b/testes/files.lua
@@ -1,7 +1,7 @@
1-- $Id: testes/files.lua $ 1-- $Id: testes/files.lua $
2-- See Copyright Notice in file lua.h 2-- See Copyright Notice in file lua.h
3 3
4global * <const> 4global <const> *
5 5
6local debug = require "debug" 6local debug = require "debug"
7 7
diff --git a/testes/goto.lua b/testes/goto.lua
index 3f1f6e69..44486e20 100644
--- a/testes/goto.lua
+++ b/testes/goto.lua
@@ -1,9 +1,9 @@
1-- $Id: testes/goto.lua $ 1-- $Id: testes/goto.lua $
2-- See Copyright Notice in file lua.h 2-- See Copyright Notice in file lua.h
3 3
4global require 4global<const> require
5global print, load, assert, string, setmetatable 5global<const> print, load, assert, string, setmetatable
6global collectgarbage, error 6global<const> collectgarbage, error
7 7
8print("testing goto and global declarations") 8print("testing goto and global declarations")
9 9
@@ -304,7 +304,7 @@ do
304 304
305 -- global variables cannot be to-be-closed 305 -- global variables cannot be to-be-closed
306 checkerr("global X<close>", "cannot be") 306 checkerr("global X<close>", "cannot be")
307 checkerr("global * <close>", "cannot be") 307 checkerr("global <close> *", "cannot be")
308 308
309 do 309 do
310 local X = 10 310 local X = 10
@@ -345,7 +345,7 @@ do
345 end 345 end
346 346
347 checkerr([[ 347 checkerr([[
348 global foo <const>; 348 global<const> foo;
349 function foo (x) return end -- ERROR: foo is read-only 349 function foo (x) return end -- ERROR: foo is read-only
350 ]], "assign to const variable 'foo'") 350 ]], "assign to const variable 'foo'")
351 351
@@ -357,7 +357,7 @@ do
357 ]], "%:2%:") -- correct line in error message 357 ]], "%:2%:") -- correct line in error message
358 358
359 checkerr([[ 359 checkerr([[
360 global * <const>; 360 global<const> *;
361 print(X) -- Ok to use 361 print(X) -- Ok to use
362 Y = 1 -- ERROR 362 Y = 1 -- ERROR
363 ]], "assign to const variable 'Y'") 363 ]], "assign to const variable 'Y'")
diff --git a/testes/literals.lua b/testes/literals.lua
index fecdd6d3..336ef585 100644
--- a/testes/literals.lua
+++ b/testes/literals.lua
@@ -3,7 +3,7 @@
3 3
4print('testing scanner') 4print('testing scanner')
5 5
6global * <const> 6global <const> *
7 7
8local debug = require "debug" 8local debug = require "debug"
9 9
diff --git a/testes/locals.lua b/testes/locals.lua
index 99ff9edc..02f41980 100644
--- a/testes/locals.lua
+++ b/testes/locals.lua
@@ -1,7 +1,7 @@
1-- $Id: testes/locals.lua $ 1-- $Id: testes/locals.lua $
2-- See Copyright Notice in file lua.h 2-- See Copyright Notice in file lua.h
3 3
4global * <const> 4global <const> *
5 5
6print('testing local variables and environments') 6print('testing local variables and environments')
7 7
@@ -181,23 +181,25 @@ assert(x==20)
181A = nil 181A = nil
182 182
183 183
184do -- constants 184do print("testing local constants")
185 global assert<const>, load, string, X 185 global assert<const>, load, string, X
186 X = 1 -- not a constant 186 X = 1 -- not a constant
187 local a<const>, b, c<const> = 10, 20, 30 187 local a<const>, b, c<const> = 10, 20, 30
188 b = a + c + b -- 'b' is not constant 188 b = a + c + b -- 'b' is not constant
189 assert(a == 10 and b == 60 and c == 30) 189 assert(a == 10 and b == 60 and c == 30)
190
190 local function checkro (name, code) 191 local function checkro (name, code)
191 local st, msg = load(code) 192 local st, msg = load(code)
192 local gab = string.format("attempt to assign to const variable '%s'", name) 193 local gab = string.format("attempt to assign to const variable '%s'", name)
193 assert(not st and string.find(msg, gab)) 194 assert(not st and string.find(msg, gab))
194 end 195 end
196
195 checkro("y", "local x, y <const>, z = 10, 20, 30; x = 11; y = 12") 197 checkro("y", "local x, y <const>, z = 10, 20, 30; x = 11; y = 12")
196 checkro("x", "local x <const>, y, z <const> = 10, 20, 30; x = 11") 198 checkro("x", "local x <const>, y, z <const> = 10, 20, 30; x = 11")
197 checkro("z", "local x <const>, y, z <const> = 10, 20, 30; y = 10; z = 11") 199 checkro("z", "local x <const>, y, z <const> = 10, 20, 30; y = 10; z = 11")
198 checkro("foo", "local foo <const> = 10; function foo() end") 200 checkro("foo", "local<const> foo = 10; function foo() end")
199 checkro("foo", "local foo <const> = {}; function foo() end") 201 checkro("foo", "local<const> foo <const> = {}; function foo() end")
200 checkro("foo", "global foo <const>; function foo() end") 202 checkro("foo", "global<const> foo <const>; function foo() end")
201 checkro("XX", "global XX <const>; XX = 10") 203 checkro("XX", "global XX <const>; XX = 10")
202 checkro("XX", "local _ENV; global XX <const>; XX = 10") 204 checkro("XX", "local _ENV; global XX <const>; XX = 10")
203 205
@@ -218,8 +220,18 @@ do -- constants
218end 220end
219 221
220 222
223
221print"testing to-be-closed variables" 224print"testing to-be-closed variables"
222 225
226
227do
228 local st, msg = load("local <close> a, b")
229 assert(not st and string.find(msg, "multiple"))
230
231 local st, msg = load("local a<close>, b<close>")
232 assert(not st and string.find(msg, "multiple"))
233end
234
223local function stack(n) n = ((n == 0) or stack(n - 1)) end 235local function stack(n) n = ((n == 0) or stack(n - 1)) end
224 236
225local function func2close (f, x, y) 237local function func2close (f, x, y)
diff --git a/testes/math.lua b/testes/math.lua
index 242579b1..0d228d09 100644
--- a/testes/math.lua
+++ b/testes/math.lua
@@ -8,11 +8,10 @@ local string = require "string"
8 8
9global none 9global none
10 10
11global print, assert, pcall, type, pairs, load 11global<const> print, assert, pcall, type, pairs, load
12global tonumber, tostring, select 12global<const> tonumber, tostring, select
13 13
14local minint <const> = math.mininteger 14local<const> minint, maxint = math.mininteger, math.maxinteger
15local maxint <const> = math.maxinteger
16 15
17local intbits <const> = math.floor(math.log(maxint, 2) + 0.5) + 1 16local intbits <const> = math.floor(math.log(maxint, 2) + 0.5) + 1
18assert((1 << intbits) == 0) 17assert((1 << intbits) == 0)
diff --git a/testes/nextvar.lua b/testes/nextvar.lua
index e5a97178..03810a8e 100644
--- a/testes/nextvar.lua
+++ b/testes/nextvar.lua
@@ -1,7 +1,7 @@
1-- $Id: testes/nextvar.lua $ 1-- $Id: testes/nextvar.lua $
2-- See Copyright Notice in file lua.h 2-- See Copyright Notice in file lua.h
3 3
4global * <const> 4global <const> *
5 5
6print('testing tables, next, and for') 6print('testing tables, next, and for')
7 7
diff --git a/testes/pm.lua b/testes/pm.lua
index 1700ca2c..720d2a35 100644
--- a/testes/pm.lua
+++ b/testes/pm.lua
@@ -6,7 +6,7 @@
6 6
7print('testing pattern matching') 7print('testing pattern matching')
8 8
9global * <const> 9global <const> *
10 10
11local function checkerror (msg, f, ...) 11local function checkerror (msg, f, ...)
12 local s, err = pcall(f, ...) 12 local s, err = pcall(f, ...)
diff --git a/testes/strings.lua b/testes/strings.lua
index 455398c3..46912d43 100644
--- a/testes/strings.lua
+++ b/testes/strings.lua
@@ -3,7 +3,7 @@
3 3
4-- ISO Latin encoding 4-- ISO Latin encoding
5 5
6global * <const> 6global <const> *
7 7
8print('testing strings and string library') 8print('testing strings and string library')
9 9
diff --git a/testes/utf8.lua b/testes/utf8.lua
index ec9b706f..143c6d34 100644
--- a/testes/utf8.lua
+++ b/testes/utf8.lua
@@ -3,7 +3,7 @@
3 3
4-- UTF-8 file 4-- UTF-8 file
5 5
6global * <const> 6global <const> *
7 7
8print "testing UTF-8 library" 8print "testing UTF-8 library"
9 9