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);
|
||||
LValue v = vm.tolnumber(2);
|
||||
vm.resettop();
|
||||
if ( ! v.isNil() )
|
||||
vm.pushlvalue(v);
|
||||
vm.pushlvalue(v);
|
||||
} else {
|
||||
if ( base < 2 || base > 36 )
|
||||
vm.typerror(3, "base out of range");
|
||||
@@ -338,7 +337,7 @@ public class BaseLib extends LFunction {
|
||||
break;
|
||||
}
|
||||
case COLLECTGARBAGE: {
|
||||
String s = vm.checkstring(2);
|
||||
String s = vm.optstring(2, "collect");
|
||||
int result = 0;
|
||||
vm.resettop();
|
||||
if ( "collect".equals(s) )
|
||||
|
||||
@@ -661,7 +661,7 @@ public class StringLib extends LFunction {
|
||||
* changed to lowercase. All other characters are left unchanged.
|
||||
* 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();
|
||||
vm.resettop();
|
||||
vm.pushstring( s );
|
||||
@@ -1084,7 +1084,9 @@ public class StringLib extends LFunction {
|
||||
case ')':
|
||||
return end_capture( soffset, poffset + 1 );
|
||||
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':
|
||||
soffset = matchbalance( soffset, poffset + 2 );
|
||||
if ( soffset == -1 ) return -1;
|
||||
|
||||
@@ -151,4 +151,18 @@ for i,letter in ipairs(letters) do
|
||||
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