Skip to content

LuaFunction and InvokeAsync #225

@RobertoPeters

Description

@RobertoPeters

I try to call a function in Lua within C#. However, It seems that LuaFunction does not have a method InvokeAsync.
Should I use state.CallAsync? Or what am I doing wrong?

var results = await state.DoFileAsync("lua2cs.lua");
var func = results[0].Read<LuaFunction>();

// Execute the function with arguments
var funcResults = await func.InvokeAsync(state, new[] { 1, 2 });

// 3
Console.WriteLine(funcResults[0]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions