// init lua
$lua = new Lua();
/**
* Hello world method
*/
function helloWorld()
{
    return "hello world";
}
// register our hello world method
$lua->registerCallback("helloWorld", helloWorld);
$lua->eval("
    -- call php method
    local retVal = helloWorld()
    print(retVal)
");
// register our hello world method but using an other name
$lua->registerCallback("worldHello", helloWorld);
// run our lua script
$lua->eval("
    -- call php method
    local retVal = worldHello()
    print(retVal)
");