Skip to content

luerl_eval:call/3: Support the 5-elements function tuple #12

Merged
merged 1 commit into from Sep 28, 2012

2 participants

@dumbbell

This fixes the case where a reference to a function is returned by a Lua
code and executed from an Erlang function.

Here's a code sample:

    % Load Lua script.
    {ok, Chunk} = luerl:loadfile("callback.lua"),
    % Run the script: it returns a reference to a function.
    St = luerl:init(),
    {[Fun | _], St1} = luerl:do(Chunk, St),
    % Execute the returned Lua function.
    luerl:call(Fun, [], St1).

The callback.lua script could be:

    function callback()
        print("It works!")
    end
    return callback
@dumbbell dumbbell luerl_eval:call/3: Support the 5-elements function tuple
This fixes the case where a reference to a function is returned by a Lua
code and executed from an Erlang function.

Here's a code sample:
    % Load Lua script.
    {ok, Chunk} = luerl:loadfile("callback.lua"),
    % Run the script: it returns a reference to a function.
    St = luerl:init(),
    {[Fun | _], St1} = luerl:do(Chunk, St),
    % Execute the returned Lua function.
    luerl:call(Fun, [], St1).

The callback.lua script could be:
    function callback()
        print("It works!")
    end
    return callback
397a247
@rvirding rvirding merged commit fe271a2 into rvirding:master Sep 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.