Allow metatable operations on values of all types, and use the metatable

on strings as the string package, so that string functions can be called
with self (:) syntax. Autoload test case now inexplicably fails more,
but it was already broken.
This commit is contained in:
Ian Farmer
2007-09-08 20:54:40 +00:00
parent e30646bcf8
commit aa44eedf4b
8 changed files with 86 additions and 30 deletions

View File

@@ -64,6 +64,10 @@ public class LuaJTest extends TestCase {
runTest( "compare" );
}
public void testMetatables() throws IOException, InterruptedException {
runTest( "metatables" );
}
public void testSelect() throws IOException, InterruptedException {
runTest( "select" );
}

View File

@@ -0,0 +1,5 @@
-- The purpose of this test case is to demonstrate that
-- basic metatable operations on non-table types work.
-- i.e. that s.sub(s,...) could be used in place of string.sub(s,...)
local s = "hello"
print(s:sub(2,4))

Binary file not shown.