Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limited array datatype supports #10

Open
ngocdg opened this issue Jan 2, 2023 · 3 comments
Open

Limited array datatype supports #10

ngocdg opened this issue Jan 2, 2023 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@ngocdg
Copy link

ngocdg commented Jan 2, 2023

#include <Array.au3>
#include './N.au3'

Local $o = NGlobal()
Local $a = [1, 2]
$o.arr = $a

NMain(main)

Func main()

	;Change an element
	;~ $o.arr[0] = 3 ; <-- errorstdout: Statement cannot be just an expression.
	
	Local $t = $o.arr
	$t[0] = 3
	$o.arr = $t

	ConsoleWrite($o.arr[0] & @CRLF)
	


	;Display array
	;~ _ArrayDisplay($o.arr) ; <-- errorstdout: Expected a variable in user function call.

	_ArrayDisplay($t)

EndFunc

Temporary workarounds that I've tried:

  • Display using _ArrayDisplay by assigning the array (from the global state) to a new local variable.
  • Manipulate also by assigning the array to a new local variable, then reassigning it to the global state.
@nomi-san nomi-san added enhancement New feature or request help wanted Extra attention is needed labels Jan 2, 2023
@nomi-san
Copy link
Owner

nomi-san commented Jan 2, 2023

This library does not support array datatype.

ConsoleWrite($o.arr[0] & @\CRLF)

This line works because AutoIt supports array's get-index on an expression chain.

( ( $o ).invoke( 'arr' ) -> @value ).index( 0 ) -> @return

In AutoItObject, they handled array datatype in object invoking with SAFEARRAY.

$object.arr[0]          ; get
$object.arr[0] = any    ; set

IDispatch::Invoke(id, args, &ret)
  // known member "arr" as SAFEARRAY
  // uses SafeArrayAccessData

@BiatuAutMiahn
Copy link

@nomi-san, do you have any intention to implement array support? or is that not possible?

@nomi-san
Copy link
Owner

nomi-san commented Dec 1, 2023

@BiatuAutMiahn that's possible, I will add support in next month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants