Lua::assign
PHP function
Edit on GitHub ✎
(PECL lua >=0.9.0)
Assign a PHP variable to Lua
Description
Lua::assign(string $name, string $value): mixed
Func
Parameters
namevalue
Return Values
Returns $this or null on failure.
Examples
Lua::assign()example
php
<?php
$lua = new Lua();
$lua->assign("php_var", array(1=>1, 2, 3)); //lua table index begin with 1
$lua->eval(<<<CODE
print(php_var);
CODE
);
?>The above example will output:
output
Array
(
[1] => 1
[2] => 2
[3] => 3
)