Module talk:audio
Add topicAppearance
Latest comment: 5 months ago by Benwing2 in topic use of table
Usage
[edit]@Surjection Hello, am I correctly understanding the usage of format_audios
in this module? I am trying to call it like this:
local function show_audio_file(file, caption) caption = caption or "Audio" return require("Module:audio").format_audios ( { lang = lang, audios = {{file = {file}, }, }, caption = caption } ) end
... to format audios in the module at Module:User:Kiril kovachev/bg-pronunciation. But I'm getting
Lua error: invalid replacement value (a table)
with a stack trace:
Backtrace:
- [C]: in function "v"
- mw.ustring.lua:84: in function "gsub"
- Module:audio:20: in function "format_audio_file"
- Module:audio:46: ?
- (tail call): ?
- Module:User:Kiril_kovachev/bg-pronunciation:401: in function "format_audio"
- Module:User:Kiril_kovachev/bg-pronunciation:447: in function "chunk"
- mw.lua:527: ?
- [C]: ?
As far as I can tell, I passed an object with the same format as the comment in the module described (I copy-pasted it an substituted my fields) but evidently I must be misunderstanding something. Thanks for any help, Kiril kovachev (talk) 12:41, 26 July 2023 (UTC)
- I think it is a typo in the documentation. The filename shouldn't be inside a one-element table, so the correct format is
audios = {{file = file }, },
— SURJECTION / T / C / L / 20:11, 26 July 2023 (UTC)- I see, thanks for the clarification. Kiril kovachev (talk) 10:46, 27 July 2023 (UTC)
use of table
[edit]@Ioaxxere Feel free to rework the HTML of the template. I just copied what was there already. Benwing2 (talk) 00:04, 4 June 2024 (UTC)