script.gd 716 B

123456789101112131415161718192021222324252627282930
  1. extends MainLoop
  2. func _initialize():
  3. OS.exit_code = 1
  4. var native_script = load("res://gdexample.gdns")
  5. print("Native Script ", native_script)
  6. if not native_script || !is_instance_valid(native_script):
  7. return
  8. print("Library ", native_script.library)
  9. if not native_script.library || !is_instance_valid(native_script.library):
  10. return
  11. var ref = native_script.new()
  12. print("Reference ", ref)
  13. if not ref || !is_instance_valid(ref):
  14. return
  15. print("Reference name ", ref.name)
  16. if ref.name != "SimpleClass":
  17. return
  18. print("Reference value ", ref.value)
  19. if ref.value != 0:
  20. return
  21. print("Call method ", ref.method(1))
  22. if ref.method(1) != 1:
  23. return
  24. OS.exit_code = 0
  25. func _idle(_delta):
  26. return true