0.52: Small fixes for closer conformance with regular Lua.
This commit is contained in:
@@ -262,7 +262,6 @@ public class BaseLib extends LFunction {
|
|||||||
vm.checkany(2);
|
vm.checkany(2);
|
||||||
LValue v = vm.tolnumber(2);
|
LValue v = vm.tolnumber(2);
|
||||||
vm.resettop();
|
vm.resettop();
|
||||||
if ( ! v.isNil() )
|
|
||||||
vm.pushlvalue(v);
|
vm.pushlvalue(v);
|
||||||
} else {
|
} else {
|
||||||
if ( base < 2 || base > 36 )
|
if ( base < 2 || base > 36 )
|
||||||
@@ -338,7 +337,7 @@ public class BaseLib extends LFunction {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case COLLECTGARBAGE: {
|
case COLLECTGARBAGE: {
|
||||||
String s = vm.checkstring(2);
|
String s = vm.optstring(2, "collect");
|
||||||
int result = 0;
|
int result = 0;
|
||||||
vm.resettop();
|
vm.resettop();
|
||||||
if ( "collect".equals(s) )
|
if ( "collect".equals(s) )
|
||||||
|
|||||||
@@ -1084,7 +1084,9 @@ public class StringLib extends LFunction {
|
|||||||
case ')':
|
case ')':
|
||||||
return end_capture( soffset, poffset + 1 );
|
return end_capture( soffset, poffset + 1 );
|
||||||
case L_ESC:
|
case L_ESC:
|
||||||
switch ( p.luaByte( poffset+1 ) ) {
|
if ( poffset + 1 == p.length() )
|
||||||
|
vm.error("malformed pattern (ends with '%')");
|
||||||
|
switch ( p.luaByte( poffset + 1 ) ) {
|
||||||
case 'b':
|
case 'b':
|
||||||
soffset = matchbalance( soffset, poffset + 2 );
|
soffset = matchbalance( soffset, poffset + 2 );
|
||||||
if ( soffset == -1 ) return -1;
|
if ( soffset == -1 ) return -1;
|
||||||
|
|||||||
@@ -152,3 +152,17 @@ for i,letter in ipairs(letters) do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
|
local function fmterr(...)
|
||||||
|
local r, s = pcall(...)
|
||||||
|
if r then
|
||||||
|
return s
|
||||||
|
else
|
||||||
|
s = string.gsub(s, "stdin:%d+:%s*", "")
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
print(fmterr(string.find, "ab%c)0(", "%"))
|
||||||
|
print(fmterr(string.find, "ab%c)0(", "("))
|
||||||
|
print(pcall(string.find, "ab%c)0(", ")"))
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
version: 0.51
|
version: 0.52
|
||||||
|
|||||||
Reference in New Issue
Block a user