Lua Controller: Fix $item_description() documentation and translation
This commit is contained in:
parent
240c6e20ab
commit
61e001dc6d
8
init.lua
8
init.lua
@ -55,6 +55,14 @@ techage.S = minetest.get_translator("techage")
|
||||
-- Load mod storage
|
||||
techage.storage = minetest.get_mod_storage()
|
||||
|
||||
-- Ensure compatibility with older Minetest versions by providing
|
||||
-- a dummy implementation of `minetest.get_translated_string`.
|
||||
if not minetest.get_translated_string then
|
||||
minetest.get_translated_string = function(lang_code, string)
|
||||
return string
|
||||
end
|
||||
end
|
||||
|
||||
-- Basis features
|
||||
local MP = minetest.get_modpath("techage")
|
||||
dofile(MP.."/basis/lib.lua") -- helper functions
|
||||
|
@ -189,13 +189,13 @@ techage.lua_ctlr.register_function("item_description", {
|
||||
cmnd = function(self, itemstring)
|
||||
local item_def = minetest.registered_items[itemstring]
|
||||
if item_def and item_def.description then
|
||||
return item_def.description
|
||||
return minetest.get_translated_string("en", item_def.description)
|
||||
end
|
||||
return ""
|
||||
end,
|
||||
help = " $item_description(itemstring)\n"..
|
||||
" Get the description for a specified itemstring.\n"..
|
||||
' example: desc = $itemstring("default:apple")'
|
||||
' example: desc = $item_description("default:apple")'
|
||||
})
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user