Открыть меню
Открыть персональное меню
Вы не представились системе
Your IP address will be publicly visible if you make any edits.

Модуль:Logic/doc

Материал из wiki.iccup.org
Версия от 15:46, 31 августа 2024; DarkMuse (обсуждение | вклад) (Новая страница: «==API== {{ApiDocStart|Logic|link=Module:Logic}} {{ApiDoc|emptyOr|params=val1: value, val2: value, default: value|description=Returns the first non-empty value.|returns=value}} {{ApiDoc|isEmpty|params=val: any|description=Checks if a value or table is empty.|returns=boolean}} {{ApiDoc|isNumeric|params=val: value|description=Checks if a value is numeric.|returns=boolean}} {{ApiDoc|isNotEmpty|params=val: any|description=Checks if a value or table is not empty.|...»)
(разн.) ← Предыдущая версия | Текущая версия (разн.) | Следующая версия → (разн.)

Это страница документации Модуль:Logic.

API[править код]

Программное имя: Logic


emptyOr (val1: value, val2: value, default: value) → value

Returns the first non-empty value.


{{#iccupdb_datapoint:API_Logic/doc_emptyOr

     |type=api
     |name=emptyOr
     |information=
     |image=
     |date=
     |extradata={{#iccupdb_create_json:
       |description=Returns the first non-empty value.
       |params=val1: value, val2: value, default: value
       |returns=value
       |module=Module:Logic
     }}
   }}


isEmpty (val: any) → boolean

Checks if a value or table is empty.


{{#iccupdb_datapoint:API_Logic/doc_isEmpty

     |type=api
     |name=isEmpty
     |information=
     |image=
     |date=
     |extradata={{#iccupdb_create_json:
       |description=Checks if a value or table is empty.
       |params=val: any
       |returns=boolean
       |module=Module:Logic
     }}
   }}


isNumeric (val: value) → boolean

Checks if a value is numeric.


{{#iccupdb_datapoint:API_Logic/doc_isNumeric

     |type=api
     |name=isNumeric
     |information=
     |image=
     |date=
     |extradata={{#iccupdb_create_json:
       |description=Checks if a value is numeric.
       |params=val: value
       |returns=boolean
       |module=Module:Logic
     }}
   }}


isNotEmpty (val: any) → boolean

Checks if a value or table is not empty.


{{#iccupdb_datapoint:API_Logic/doc_isNotEmpty

     |type=api
     |name=isNotEmpty
     |information=
     |image=
     |date=
     |extradata={{#iccupdb_create_json:
       |description=Checks if a value or table is not empty.
       |params=val: any
       |returns=boolean
       |module=Module:Logic
     }}
   }}


nilOr (...) → value

Returns the first non-nil value. Function arguments are lazily evaluated, providing a way to short-circuit checks.


{{#iccupdb_datapoint:API_Logic/doc_nilOr

     |type=api
     |name=nilOr
     |information=
     |image=
     |date=
     |extradata={{#iccupdb_create_json:
       |description=Returns the first non-nil value. Function arguments are lazily evaluated, providing a way to short-circuit checks.
       |params=...
       |returns=value
       |module=Module:Logic
     }}
   }}


nilThrows (val: any) → value or error

Throws an error if val is nil.


{{#iccupdb_datapoint:API_Logic/doc_nilThrows

     |type=api
     |name=nilThrows
     |information=
     |image=
     |date=
     |extradata={{#iccupdb_create_json:
       |description=Throws an error if val is nil.
       |params=val: any
       |returns=value or error
       |module=Module:Logic
     }}
   }}


readBool (val: value) → boolean

Interprets the input as a boolean value (true/false).


{{#iccupdb_datapoint:API_Logic/doc_readBool

     |type=api
     |name=readBool
     |information=
     |image=
     |date=
     |extradata={{#iccupdb_create_json:
       |description=Interprets the input as a boolean value (true/false).
       |params=val: value
       |returns=boolean
       |module=Module:Logic
     }}
   }}


readBoolOrNil (val: value) → boolean?

Converts a boolean from its representations (true/false, 1/0, or their string equivalents), or returns nil if not a recognized representation.


{{#iccupdb_datapoint:API_Logic/doc_readBoolOrNil

     |type=api
     |name=readBoolOrNil
     |information=
     |image=
     |date=
     |extradata={{#iccupdb_create_json:
       |description=Converts a boolean from its representations (true/false, 1/0, or their string equivalents), or returns nil if not a recognized representation.
       |params=val: value
       |returns=boolean?
       |module=Module:Logic
     }}
   }}


tryCatch (try: function, catch: function) → result or catch result

Attempts to execute the "try" function. If it fails, the "catch" function is executed.


{{#iccupdb_datapoint:API_Logic/doc_tryCatch

     |type=api
     |name=tryCatch
     |information=
     |image=
     |date=
     |extradata={{#iccupdb_create_json:
       |description=Attempts to execute the "try" function. If it fails, the "catch" function is executed.
       |params=try: function, catch: function
       |returns=result or catch result
       |module=Module:Logic
     }}
   }}


try (f: function) ResultOrError

Executes the function and captures its result or any error in a ResultOrError instance.


{{#iccupdb_datapoint:API_Logic/doc_try

     |type=api
     |name=try
     |information=
     |image=
     |date=
     |extradata={{#iccupdb_create_json:
       |description=Executes the function and captures its result or any error in a ResultOrError instance.
       |params=f: function
       |returns=ResultOrError
       |module=Module:Logic
     }}
   }}


Посмотрите всю нашу документацию iCCup здесь.


Содержание