Add new built-in function type() that returns the name of the type of

the given value as a string. Includes test case.
This commit is contained in:
Ian Farmer
2007-07-16 02:37:08 +00:00
parent c65dec54fb
commit 635f127cd0
14 changed files with 69 additions and 11 deletions

View File

@@ -47,6 +47,14 @@ public class LuaJTest extends TestCase {
runTest( "compare" );
}
public void testSetlist() throws IOException, InterruptedException {
runTest( "setlist" );
}
public void testType() throws IOException, InterruptedException {
runTest( "type" );
}
public void testUpvalues() throws IOException, InterruptedException {
runTest( "upvalues" );
}
@@ -55,10 +63,6 @@ public class LuaJTest extends TestCase {
runTest( "upvalues2" );
}
public void testSetlist() throws IOException, InterruptedException {
runTest( "setlist" );
}
private void runTest( String testName ) throws IOException, InterruptedException {
// add LuaJava bindings
LuaJava.install();

8
src/test/res/type.lua Normal file
View File

@@ -0,0 +1,8 @@
print(type(5))
print(type(3.14))
print(type("hello"))
print(type(function() return 1 end))
print(type({}))
print(type(nil))
print(type(2 < 5))
print(type(pairs({})))

BIN
src/test/res/type.luac Normal file

Binary file not shown.