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

LuaAPI gives C# null Callables #170

Closed
Trey2k opened this issue Oct 7, 2023 · 2 comments
Closed

LuaAPI gives C# null Callables #170

Trey2k opened this issue Oct 7, 2023 · 2 comments
Assignees
Labels
bug Something isn't working Mono C#

Comments

@Trey2k
Copy link
Member

Trey2k commented Oct 7, 2023

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:

@Trey2k Trey2k added the bug Something isn't working label Oct 7, 2023
@Trey2k Trey2k self-assigned this Oct 7, 2023
@Trey2k
Copy link
Member Author

Trey2k commented Oct 8, 2023

This issue with probably not be resolved for awhile. I suggest c# users stick with lua.call_function for now.

@Trey2k Trey2k added the Mono C# label Oct 8, 2023
@Trey2k
Copy link
Member Author

Trey2k commented Oct 10, 2023

Resolved by #172, i dont think C# will get CallableCustoms any time soon.

@Trey2k Trey2k closed this as completed Oct 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working Mono C#
Projects
None yet
Development

No branches or pull requests

1 participant