Введение
Иногда может понадобиться сохранить определенный список аргументов функции, чтобы потом вызвать её с нужными параметрами.
Описание
Сохранить аргументы с функцией в объект:
Код
namefunction.save(arg1,arg2...) -> int obj,где namefunction - имя оригинальной функции,
(arg1,arg2...) - её аргументы.
Вызвать:
Вернуть значения:
Код
namefunction.namepar1, namefunction.namepar2,где nameparN - имя возвращаемого параметра
Удалить (очистить):
---Пример---
Код
function test_1 takes integer a, integer b returns nothing test_1.ret(a+1,b-1)endfunction//! runtextmacro FUNC2("test_1","integer","integer")//! runtextmacro RET2("test_1","integer","i1","integer","i2")function test_2 takes integer a, integer b, real c returns nothing printr(a+c,b+c)
endfunction//! runtextmacro FUNC3("test_2","integer","integer","real")function MyCode1 takes nothing returns nothing integer save = test_1.save(1,5) frun(save)
fdel(save)
save = test_2.save( test_1.i1, test_1.i2, 10. ) frun(save)
fdel(save)
endfunction
Выведет:
Код
a+c 12.000; b+c 14.000
Дополнительно