readme markup fixes
This commit is contained in:
parent
ad661e86aa
commit
51190b92f7
@ -16,10 +16,10 @@ Smartfs provides 2nd generation Minetest forms to replace clunky formspec string
|
|||||||
Smartfs can be used as a library or a mod.
|
Smartfs can be used as a library or a mod.
|
||||||
|
|
||||||
To use smartfs as a library, copy the smartfs.lua file to your mod folder and add
|
To use smartfs as a library, copy the smartfs.lua file to your mod folder and add
|
||||||
local smartfs = dofile(minetest.get\_modpath(minetest.get\_current\_modname()).."/smartfs.lua")
|
`local smartfs = dofile(minetest.get_modpath(minetest.get_current_modname()).."/smartfs.lua")`
|
||||||
|
|
||||||
to the top of your init.lua. If your mod is splitted to multiple files you can transport the library reference trough your mod namespace
|
to the top of your init.lua. If your mod is splitted to multiple files you can transport the library reference trough your mod namespace
|
||||||
yourmod.smartfs = dofile(minetest.get\_modpath(minetest.get\_current\_modname()).."/smartfs.lua")
|
`yourmod.smartfs = dofile(minetest.get_modpath(minetest.get_current_modname()).."/smartfs.lua")`
|
||||||
|
|
||||||
To use smartfs as a mod, add it to your game's mods folder or to the user mods folder and enable it.
|
To use smartfs as a mod, add it to your game's mods folder or to the user mods folder and enable it.
|
||||||
You need to set up a dependency for your mod to use it. The library is available in the global "smartfs" table in this case.
|
You need to set up a dependency for your mod to use it. The library is available in the global "smartfs" table in this case.
|
||||||
@ -63,7 +63,7 @@ You can also get the element by using state:get(name). The example below will re
|
|||||||
|
|
||||||
button1 = state:get("btn1")
|
button1 = state:get("btn1")
|
||||||
--or
|
--or
|
||||||
state:get("btn1"):onClick(your\_onclick\_function
|
state:get("btn1"):onClick(your_onclick_function)
|
||||||
|
|
||||||
Both of these methods should be used inside the form creation callback function, the function you pass to smartfs.create, or in event callbacks.
|
Both of these methods should be used inside the form creation callback function, the function you pass to smartfs.create, or in event callbacks.
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ Now that you have located your element you can modify it.
|
|||||||
button1:setPos(4,0)
|
button1:setPos(4,0)
|
||||||
|
|
||||||
## Inventory Support
|
## Inventory Support
|
||||||
Smartfs supports adding a button to Sfinv, Inventory+, or Unified Inventory which will open one of your own custom forms. Use the smartfs.add\_to\_inventory(form, icon, title) function where form is the smartfs form linked to by the button, icon is the button image (only for unified inventory), and title is the button text (for inventory+ and sfinv).
|
Smartfs supports adding a button to Sfinv, Inventory+, or Unified Inventory which will open one of your own custom forms. Use the `smartfs.add_to_inventory(form, icon, title)` function where form is the smartfs form linked to by the button, icon is the button image (only for unified inventory), and title is the button text (for inventory+ and sfinv).
|
||||||
|
|
||||||
smartfs.add_to_inventory(form, icon, title)
|
smartfs.add_to_inventory(form, icon, title)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user