Skip to content

Commit

Permalink
Improve passing arguments speed
Browse files Browse the repository at this point in the history
  • Loading branch information
overfl0 committed Jan 3, 2018
1 parent 7ba4a22 commit 8e6d5ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/pbo/pythia/fn_callExtension.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ private _fnc_showHint = {
};
};

params ["_functionName", ["_args", []]];
private _result = "Pythia" callExtension (str [_functionName, _args]);
private _result = "Pythia" callExtension (str _this);
if (_result == "") exitWith {
(format ["Extension output is empty. One possible cause is BattlEye blocking the extension."]) call _fnc_showHint;
[];
Expand Down
13 changes: 9 additions & 4 deletions src/python/Adapter.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,15 @@ def python_adapter(sqf_args):
global FUNCTION_CACHE

try:
try:
full_function_name, function_args = sqf_args
except ValueError:
raise PythiaExecuteException('The syntax for calling a function is: [function_name, [args]]')
# Allow calling a [function_name] from SQF and just assume args = [] in that case
if len(sqf_args) == 1:
full_function_name = sqf_args[0]
function_args = []
else:
try:
full_function_name, function_args = sqf_args
except ValueError:
raise PythiaExecuteException('The syntax for calling a function is: [function_name, [args]]')

if not isinstance(function_args, list):
raise PythiaExecuteException('The arguments of a function need to be passed in an array')
Expand Down

0 comments on commit 8e6d5ee

Please sign in to comment.