Ben-Kerman / immersive

Language learning mpv script for looking up words within mpv and generating Anki cards
GNU General Public License v3.0
81 stars 1 forks source link

attempt to call field 'unpack' (a nil value) #2

Closed stegatxins0 closed 3 years ago

stegatxins0 commented 3 years ago

I keep getting this error when starting mpv. My mpv version is mpv 0.33.0-58-gd5ab5482a9. And I'm on Linux.

[immersive] Opened config file script-opts/immersive.conf.
[immersive] config file could not be loaded
Resuming playback. This behavior can be disabled with --no-resume-playback.
 (+) Video --vid=1 (*) '[Judas] x265 10b' (hevc 1920x1080 23.976fps)
 (+) Audio --aid=1 --alang=jpn '[Judas] Stereo (Opus)' (opus 2ch 48000Hz)
 (+) Subs  --sid=1 (*) (subrip)
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 1920x1080 yuv420p10
(Paused) AV: 00:02:37 / 00:24:08 (11%) A-V:  0.000 Cache: 128
[immersive]
[immersive] stack traceback:
[immersive]     .../stegatxins0/.config/mpv/scripts/immersive/dict/util.lua:50: in function 'create_index'
[immersive]     ...gatxins0/.config/mpv/scripts/immersive/dict/yomichan.lua:170: in function 'generic_load'
[immersive]     ...gatxins0/.config/mpv/scripts/immersive/dict/yomichan.lua:264: in function 'load'
[immersive]     ...stegatxins0/.config/mpv/scripts/immersive/dict/dicts.lua:31: in function 'load_dict'
[immersive]     ...stegatxins0/.config/mpv/scripts/immersive/dict/dicts.lua:55: in function 'handler'
[immersive]     mp.defaults:500: in function 'call_event_handlers'
[immersive]     mp.defaults:534: in function 'dispatch_events'
[immersive]     mp.defaults:493: in function <mp.defaults:492>
[immersive]     [C]: at 0x55c836e444e0
[immersive]     [C]: at 0x55c836e45020
[immersive] Lua error: ...gatxins0/.config/mpv/scripts/immersive/utility/utf_8.lua:104: attempt to call field 'unpack' (a nil value)

These are the only files I changed: immersive-dictionaries.conf

# this line is here so the file is encoded as UTF−8
# do not delete it unless you know what that means
[JMdict]
location=/home/stegatxins0/immersive-dict/JMdict/
type=yomichan

immersive.conf

# this line is here so the file is encoded as UTF−8
# do not delete it unless you know what that means
preload_dictionaries=yes

immersive-targets.conf

# this line is here so the file is encoded as UTF−8
# do not delete it unless you know what that means
[Me]
profile=User 1
deck=🍕日本語::🥇日本語
note_type=日本語
field:例文={{sentences}}
field:意味={{definitions}}
field:単語={{word}}
field:例文音声={{audio}}
field:単語音声={{word_audio}}
field:画像={{image}}

Any help will be appreciated.

Ben-Kerman commented 3 years ago

That looks like your Lua is missing a standard library function (table.unpack). If you put this in its own script or in a script you already have installed, what does it say in the terminal/console: print("table.unpack", table.unpack)? Also do the same with print(_VERSION)

My theory is that your mpv package uses LuaJIT with 5.2 compatibility disabled, so it can't find certain functions that are only present in compat mode.

stegatxins0 commented 3 years ago

You're right. print(_VERSION) give me Lua 5.1. I install lua52 and rebuild mpv and now immersive is working. Thank you very much.

stegatxins0 commented 3 years ago

EDIT: created a PR

@Ben-Kerman This is not related to the issue but I'm wondering can I view multiple dictionary definitions in the dictionary/target menu just like how yomichan works without having to ctrl+shift+a to change dictionary when I don't understand the definition.