Skip to content

NodePath property is inaccessible in Lua #1

Description

@JohnDoneth

Plugin Version: r1
Godot Version: v3.3.3

I'm trying to use a NodePath property and access it from Lua.

The code appears to register the property with Godot as it shows up and works in the inspector but is inaccessible via self in Lua.
image

Properties are working for other primitive types I've used so far but not when the type is NodePath. When I inspect self inside of _ready with the following code, I get the subsequent outcome.

local inspect = require("inspect")

local function ready(self)
  print(inspect.inspect(self))
  print(self.player_path)
end

return {
	_ready = ready,
	player_path = property({type = NodePath})
}
{
  __owner = [Node2D:1622],
  __script = {
    __getter = {},
    __path = "res://enemy.lua",
    __setter = {},
    _ready = <function 1>
  },
  <metatable> = {
    __concat = <function 2>,
    __index = <function 3>,
    __tostring = <function 4>
  }
}
nil

As you can see, the property is not on self and printing the field directly shows that it doesn't exist, as it's nil.


I've been loving this project by the way. It's great! Thank you for working on it.

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