Custom Query (3922 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (316 - 318 of 3922)

Ticket Resolution Summary Owner Reporter
#2029 Rejected Array and variable handling / suggestion Shaggi
Description
  1. Accessing temporary arrays

This could be a cool feature, and in many cases reduce code in larger expressions. Also, it will solve the problems explained later down. Example:

Func n()
	Local $Array[2] = [1,2]
	Return $Array
EndFunc

MsgBox(0,"",n()[1])
  1. Ability to have 2 variables reference the same content.

This is already working through ByRef parameter passing, however when you return a referenced parameter it creates a copy. Example:

Global $Array[2] = ["foo","foo"]
$Array2 = n($Array)
$Array2[1] = "bar"
ConsoleWrite($Array[0] & @CRLF & $Array[1])

Func n(ByRef $Array)
	Return $Array
EndFunc

This is the same with normal variables.

  1. Nested arrays / Arrays in arrays and linked lists

Since arrays can store other arrays, why cant you access them without getting bounds errors? This seems more like a faulty parsing case than a limitation within autoit:

#include <Array.au3>
Dim $a[2]
Dim $b[2]

$b[0]="foo"
$b[1]="foo"
$a[0] = "bar"
$a[1] = $b

_ArrayDisplay($a)
_ArrayDisplay($a[1])

ConsoleWrite($A[0])
ConsoleWrite($A[1][0]) ;Error

It seems that when arrays are assigned to elements of others, they are stored as temporary variables - maybe this is related to #1? If this could be fixed, it would allow many things - like a more structured design like linked lists or better ability to write something object oriented. As it stands now, the only way to modify the contents of an nested array (without creating a copy of the index, modifying and assigning back) is through byref parameter functions, so you can access the element. Example:

#include <Array.au3>
Dim $a[2]
Dim $b[2]

$b[0]="foo"
$b[1]="foo"

$a[0] = "bar"
$a[1] = $b

_ArrayDisplay($a)
_ArrayDisplay($a[1])
Change($A[1])
_ArrayDisplay($a[1])

Func Change(Byref $A)
	$A[0] = "changed"
EndFunc

It is possible to do it this way, however when you have a nested array (c) inside a nested array (b) in a array (a), it's near impossible to change contents of c without creating a new array - because as #2 states, a ByRef parameter returned is a new copy. And since you can only access nested arrays through ByRef parameters, you actually have to create a recursive byref function, that "dereferences" the array each time. This is a costly process, and pretty stupid. Example:

Func _C_NestChangeVal(ByRef $Obj, $Val, $Ref1 = -1, $Ref2 = -1,$Ref3 = -1)
	Switch @NumParams
		Case 5
			_C_NestChangeVal($Obj[$Ref3],$Val,$Ref1,$Ref2)
		Case 4
			_C_NestChangeVal($Obj[$Ref2],$Val,$Ref1)
		Case 3
			$Obj[$Ref1] = $Val
	EndSwitch
EndFunc

I hope this will be implemented, and since (i think) AutoIt supports it all, it shouldn't be that hard to do.

#3114 Rejected Array as an parameter for Call Function instead of n parameters TheDcoder
Description

I think it would be better if Call function can accept an array for the parameters of the function to call instead of n number of parameters because it will allow UDFs to call a function with a dynamic number of parameters like this:

Call ( "function" , $aParameters)

$aParameter[0] = Number of parameters (0 if none.)

$aParameter[1] = 1st parameter

...

$aParameter[n] = nth Parameter

Feature Discussion in Forum: https://www.autoitscript.com/forum/topic/176243-feature-request-array-as-an-parameter-for-call-function-instead-of-n-parameters/?do=findComment&comment=1268447

#1566 Fixed Array as its own element issue trancexx trancexx
Description

Code is:

#include <Array.au3>

Global $a[3] = [1, 2, 3]
$a[1] = $a

; And then
$b = $a[1]
$c = $b[1]
$d = $c[1]
$e = $d[1]
$f = $e[1]
;...
_ArrayDisplay($a, "Displaying $a")
_ArrayDisplay($b, "Displaying $b")
_ArrayDisplay($c, "Displaying $c")
_ArrayDisplay($d, "Displaying $d")
_ArrayDisplay($e, "Displaying $e")
_ArrayDisplay($f, "Displaying $f")

If array (old) is put as some element of its own endless* recursion occurs. Expected would be $b to be 1, 2, 3. Obvious workaround works as expected.

I tried to determine how deep it goes but my RAM was sucked up. 10000 here:

#AutoIt3Wrapper_Run_Au3check=n

	Global $0[3] = [1, 2, 3]
	$0[1] = $0

	$iMax = 10000 ; Probably 16000000 / 3 is the max
	For $i = 1 To $iMax
	Assign($i, Execute("$" & $i - 1 & "[1]"))
	Next
	_ArrayDisplay(Eval($iMax), "Displaying $" & $iMax)

If this is combined with Ticket #1565 AutoIt crashes (stack overflow).

$a = StringSplit("ab", "")
$a[1] = $a

$obj=ObjCreate("Scripting.Dictionary")
MsgBox(64, "", "It will crash now")
$obj.add("test", $a)
Batch Modify
Note: See TracBatchModify for help on using batch modify.
Note: See TracQuery for help on using queries.