Extension:WikiLambda/Creating Objects
Create a function
editTo create a new function for use in your own implementations and enable others to use it as well, follow these steps. New functions can be written in your preferred natural language.
- Go to the
Special:CreateZObject
function creation page. - Name your function.
- Define your function's inputs:
- Add/remove input fields.
- Define each input type.
- Name each input.
- Define your function output type.
- Optionally, provide multilingual options for any of these fields:
- Function name, function aliases, input labels.
- Publish your function.
Create a test
editTo create tests for your function implementations to ensure they are working properly, follow these steps:
- Find a function on your wiki, or the function you created in the previous workflow.
- Navigate to the function page.
- Click the “+” link in the tests table.
- Click on "Select Function" under "Call".
- In the field under "Function", type in the name of the function you are testing and select the function when it shows up.
- Add values for the inputs in the respective fields.
- Click on "Select Function" under "Result Validation". In the field under "Function", type in the name of the function you want to use to check the result.
- For a function whose output is String, this will be "String equality", for a function whose output is Boolean, this will be "Boolean equality".
- Add the expected value in the given field (either "Second String" or "Second Boolean").
- Publish your updates.
Create an implementation
editFunctions are brought to life in implementations created to suit your needs. Run, remix, and combine functions via implementations. We recommend creating and connecting a test before creating an implementation. To create an implementation, follow these steps:
- Find a function on your wiki.
- Navigate to the function page.
- Click the “+” link in the implementations table.
- You can create a new implementation in one of two ways:
- Code
- Select the required programming language to write the function code.
- Input your code.
- Composition:
- Create a composition using existing functions.
- Code
- Publish your updates (after running a test by clicking the round arrow on the right of the box titled Tests).