![]() |
Variable argument count?
How do I pass all or some of my however many arguments to another function taking a variable amount of arguments?
As in lua's function foo(x, y, ...) something_with(x, y) bar(...) end, I guess. |
Uhhh...could probably use the params[] array.
|
Quote:
|
Quote:
PHP Code:
|
Quote:
Edit: Uh, how do I even call that function to make params[0] actually hold a value? |
Quote:
|
Quote:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
|
Quote:
Quote:
Quote:
|
Quote:
PHP Code:
HTML Code:
1, 2Quote:
Quote:
PHP Code:
|
I've had some problems where the params[] array is erased/non-existent if you assign variables to the parameters in the function.
|
The params[] array is only created when the script is called (doesn't even need to be a function, GS1 style). That is either on an event, or when you call a function of another object. To get a variable number of parameters either use func(arg1, arg2, arg3, arg4 etc) and ignore the arguments that you don't want, or pass the parameters as array.
Currently accessing the parameters for each function as array is not possible because it would mean a big speed slowdown, although if it's really important to have it then we could add something like temp.functionparams[] which dynamically converts the function parameters to variables. |
Quote:
Quote:
|
| All times are GMT +2. The time now is 02:10 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.