lua callbacks are now object bound
[phplua.git] / tests / 016.phpt
blobb7972d5db710df89c074c72bcd7ab8b859c5f768
1 --TEST--
2 Check calling php functions with table arguments
3 --SKIPIF--
4 <?php if (!extension_loaded("lua")) print "skip"; ?>
5 --FILE--
6 <?php
7 function foo($a,$b) {
8   var_dump($a);
11 $lua = new lua();
12 $lua->expose_function("php_foo", "foo");
14 $luacode =<<< EOF
15 php_foo({"qwerty",{"lala",{"test"}}},4,{"test"});
16 x={"asdf",{"xxx","yyy",{"aaa"}}}
17 EOF;
19 $lua->evaluate($luacode);
20 var_dump($lua->x);
22 --EXPECTF--
23 array(2) {
24   [1]=>
25   string(6) "qwerty"
26   [2]=>
27   array(2) {
28     [1]=>
29     string(4) "lala"
30     [2]=>
31     array(1) {
32       [1]=>
33       string(4) "test"
34     }
35   }
37 array(2) {
38   [1]=>
39   string(4) "asdf"
40   [2]=>
41   array(3) {
42     [1]=>
43     string(3) "xxx"
44     [2]=>
45     string(3) "yyy"
46     [3]=>
47     array(1) {
48       [1]=>
49       string(3) "aaa"
50     }
51   }