Bugfix and documentation update.

This commit is contained in:
luk3yx 2020-01-28 17:56:53 +13:00
parent 0ef995ab5c
commit c551fc2b8e
2 changed files with 4 additions and 1 deletions

View File

@ -31,6 +31,8 @@ A Minetest mod library to make modifying formspecs easier.
- `formspec_ast.safe_parse(string_or_tree)`: Similar to `formspec_ast.parse`,
however will delete any elements that may crash the client (or any I
haven't added to the whitelist).
- `formspec_ast.formspec_escape(text)`: The same as `minetest.formspec_escape`,
should only be used when formspec_ast is being embedded outside of Minetest.
## AST

View File

@ -37,6 +37,7 @@ if minetest then
modpath = minetest.get_modpath('formspec_ast')
assert(minetest.get_current_modname() == 'formspec_ast',
'This mod must be called formspec_ast!')
formspec_ast.formspec_escape = minetest.formspec_escape
else
-- Probably running outside Minetest.
modpath = rawget(_G, 'FORMSPEC_AST_PATH') or '.'
@ -67,6 +68,7 @@ else
return res
end
formspec_ast.minetest = minetest
formspec_ast.formspec_escape = minetest.formspec_escape
end
formspec_ast.modpath = modpath
@ -76,4 +78,3 @@ dofile(modpath .. '/helpers.lua')
dofile(modpath .. '/safety.lua')
formspec_ast.modpath, formspec_ast.minetest = nil, nil
formspec_ast.formspec_escape = minetest.formspec_escape