4 <?php if (!extension_loaded("lua")) print "skip"; ?>
9 function phptest_no_param()
10 print("No parameters!\\n")
13 function phptest_1_param(param)
14 print("Parameter: `", param, "'!\\n")
17 function phptest_2_params(param1, param2)
18 print("Parameter 1: `", param1, "', Parameter 2: `", param2, "'!\\n")
27 $l->print("Hello world!\n");
28 $l->phptest_no_param();
30 $l->phptest_1_param();
31 $l->phptest_1_param("foobar");
33 $l->phptest_2_params();
34 $l->phptest_2_params("foo");
35 $l->phptest_2_params("foo", "bar");
39 var_dump($l->{"math.sin"}(3/2*pi()));
40 var_dump($l->{"math.cos"}(pi()));
44 $l->notexisting(2423);
45 $l->{"not.existing.function"}(432, 342);
49 var_dump($l->type("fobar"));
50 var_dump($l->multiret());
54 var_dump($l->__call("multiret", array(), 0));
55 var_dump($l->__call("multiret", array(), 1));
56 var_dump($l->__call("multiret", array(), 2));
57 var_dump($l->__call("multiret", array(), LUA::MULTRET));
60 $l->__call("print", "foo");
67 Parameter 1: `(null)', Parameter 2: `(null)'!
68 Parameter 1: `foo', Parameter 2: `(null)'!
69 Parameter 1: `foo', Parameter 2: `bar'!
81 Warning: lua::__call(): error running lua function `notexisting': attempt to call a nil value in %s on line %i
83 Warning: lua::__call(): error looking up lua function `not.existing.function': [string "return not.existing.function"]:1: unexpected symbol near '.' in %s on line %i
118 Warning: lua::__call() expects at least 2 parameters, 1 given in %s on line %i
120 Warning: lua::__call() expects parameter 2 to be array, string given in %s on line %i