0.52: Small fixes for closer conformance with regular Lua.
This commit is contained in:
@@ -262,8 +262,7 @@ 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 )
|
||||||
vm.typerror(3, "base out of range");
|
vm.typerror(3, "base out of range");
|
||||||
@@ -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) )
|
||||||
|
|||||||
@@ -661,7 +661,7 @@ public class StringLib extends LFunction {
|
|||||||
* changed to lowercase. All other characters are left unchanged.
|
* changed to lowercase. All other characters are left unchanged.
|
||||||
* The definition of what an uppercase letter is depends on the current locale.
|
* The definition of what an uppercase letter is depends on the current locale.
|
||||||
*/
|
*/
|
||||||
static void lower( LuaState vm ) {
|
static void lower( LuaState vm ) {
|
||||||
String s = vm.checkstring(2).toLowerCase();
|
String s = vm.checkstring(2).toLowerCase();
|
||||||
vm.resettop();
|
vm.resettop();
|
||||||
vm.pushstring( s );
|
vm.pushstring( 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;
|
||||||
|
|||||||
@@ -151,4 +151,18 @@ for i,letter in ipairs(letters) do
|
|||||||
end
|
end
|
||||||
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