mirror of
https://github.com/php-win-ext/php-lua.git
synced 2026-03-24 09:02:13 +01:00
35 lines
492 B
PHP
35 lines
492 B
PHP
--TEST--
|
|
LuaClosure exception
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("lua")) print "skip"; ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$l = new lua();
|
|
|
|
$l->eval(<<<CODE
|
|
function closure ()
|
|
local from = "lua";
|
|
return (function ()
|
|
print(from);
|
|
end);
|
|
end
|
|
CODE
|
|
);
|
|
|
|
$func = $l->closure();
|
|
|
|
try {
|
|
$l->call($func);
|
|
if (version_compare(PHP_VERSION, "5.3.0") >= 0) {
|
|
$func();
|
|
} else {
|
|
$func->invoke();
|
|
}
|
|
} catch (LuaException $e) {
|
|
echo $e->getMessage();
|
|
}
|
|
?>
|
|
--EXPECTF--
|
|
lualua
|