Skip to content
This repository was archived by the owner on Dec 29, 2024. It is now read-only.
This repository was archived by the owner on Dec 29, 2024. It is now read-only.

LuaAPI gives C# null Callables  #170

@Trey2k

Description

@Trey2k

Describe the bug
While working on #169 i noticed c# fails to pull lua callables.

To Reproduce
The following CS class gets a null Callable. While the equivalent GDScript works as expected.

using Godot;

using System;

public partial class Node2D : Godot.Node2D
{
	private LuaApi lua = new LuaApi();

	public override void _Ready() {
		LuaError error = lua.DoString(@"
                                  function test()
                                  	return ""This is a test message.""
                                  end
                                  ");

		if (error != null && error.Message != "") {
			GD.Print("An error occurred calling DoString.");
			GD.Print("ERROR %d: %s", error.Type, error.Message);
		}

		var val = lua.PullVariant("test");
		if (val.GetType() == typeof(LuaError)) {
			GD.Print("ERROR %d: %s", error.Type, error.Message);
			return;
		}

		Callable test = val.AsCallable();
		Godot.Collections.Array Params = new();
		GD.Print(test.Call(Params));
	}
}

Expected behavior
A valid Callable returned

Enviromint:

Metadata

Metadata

Assignees

Labels

MonoC#bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions