explained what files in fs/ folder are for

This commit is contained in:
Sokomine 2023-12-08 22:43:39 +01:00
parent abbb8cf123
commit eb6d75c8fc

29
fs/README.md Normal file
View File

@ -0,0 +1,29 @@
In general, files in here ought to provide exactly tow functions:
```
yl_speak_up.input_fs_<FILE_NAME> = function(player, formname, fields)
-- react to whatever input the player supplied;
-- usually show another formspec
return
end
```
and:
```
yl_speak_up.get_fs_<FILE_NAME> = function(player, param)
-- return a formspec string
return formspec_string
end
```
Additional (local) helper functions may be included if they are only used
by those two functions above and not used elsewhere in the mod.
That is not a technical requirement but mostly for keeping things clean.
These functions are usually *not* declared as local and may be overridden
from outside if needed.
There may be no function for handling input if the formspec only displays
something and only offers a back button or buttons to other formspecs.
The actual displaying of the formspecs and calling of these functions happens
in `show_fs.lua`.