#[Lua cutscenes] choiceDialog() not working?

157 messages · Page 1 of 1 (latest)

unborn inlet
#
choiceDialog({
        {"Dzhake_Cuteline_1_6_1"},
        {"Dzhake_Cuteline_1_6_2"},
        {"Dzhake_Cuteline_1_6_3"},
        {"Dzhake_Cuteline_1_6_4"},
        {"Dzhake_Cuteline_1_6_5"}
    })

And error in log.txt is:

System.InvalidCastException: Object cannot be stored in an array of this type.
   at System.Array.InternalSetValue(Object value, IntPtr flattenedIndex)
   at NLua.MetaFunctions.CreateParamsArray(Lua luaState, ExtractValue extractValue, Type paramArrayType, Int32 startIndex, Int32 count) in /home/vsts/work/1/s/external/NLua/src/Metatables.cs:line 1509
   at NLua.MetaFunctions.MatchParameters(Lua luaState, MethodBase method, MethodCache methodCache, Int32 skipParam) in /home/vsts/work/1/s/external/NLua/src/Metatables.cs:line 1523
   at NLua.Method.LuaMethodWrapper.CallMethodFromName(Lua luaState) in /home/vsts/work/1/s/external/NLua/src/Method/LuaMethodWrapper.cs:line 205
   at NLua.Method.LuaMethodWrapper.Call(IntPtr state) in /home/vsts/work/1/s/external/NLua/src/Method/LuaMethodWrapper.cs:line 310
   at NLua.MetaFunctions.RunFunctionDelegate(IntPtr luaState) in /home/vsts/work/1/s/external/NLua/src/Metatables.cs:line 112
   at KeraLua.NativeMethods.lua_pcallk(IntPtr luaState, Int32 nargs, Int32 nresults, Int32 errorfunc, IntPtr ctx, IntPtr k)
   at NLua.Lua.CallFunction(Object function, Object[] args, Type[] returnTypes) in /home/vsts/work/1/s/external/NLua/src/Lua.cs:line 847
   at NLua.LuaFunction.Call(Object[] args) in /home/vsts/work/1/s/external/NLua/src/LuaFunction.cs:line 46
   at Celeste.Mod.LuaCoroutine.MoveNext() in /home/vsts/work/1/s/Celeste.Mod.mm/Mod/Helpers/LuaCoroutine.cs:line 21
   at Celeste.Mod.LuaCutscenes.LuaHelper.SafeMoveNext(LuaCoroutine enumerator)

#

that's english.txt

mellow frost
#

use table.unpack in choiceDialog

unborn inlet
#

(this didn't work)

mellow frost
#

at least i'm pretty sure it should

unborn inlet
#

there is old choice widegladeline2

#

i use choiceDialog()

mellow frost
#

the crash is the same

unborn inlet
unborn inlet
#

hhm?

#

but then this should work

#

shouldn't it?

#

but it doesn't

#

let me try with just two values

#

maybe 5 is too much

#

nah

mellow frost
#

well nvm

#

it doesn't take varargs

mellow frost
#

it takes in a table

unborn inlet
#

but it doesn't

mellow frost
#

is this your entire cutscene or is the something more

unborn inlet
#

there is something more but i commented everything

#

that's how does it look

#

literally

#

"say"

#

"choiceDialog"

#

it errors after say end

mellow frost
#

after say("1_5")?

unborn inlet
#

yes.

#

(dzhake.say() it auto-adds Dzhake_Cuteline_ before text)

mellow frost
#

i have no clue

unborn inlet
#

ping Cruor

mellow frost
#

@upbeat snow do you perhaps have a number to an exorcist, since i don't understand this

#

neither of the used functions use varargs

#

my only suspicion is that luaCutscenes's choiceDialog uses a vararg function

unborn inlet
#

Popax: 💤

#

i'll wait

mellow frost
#

WAIT

unborn inlet
#

?????? :shokeline:

mellow frost
#

choiceDialog uses choice without table.unpack

unborn inlet
#

thanks for seeing problem

#

i'll wait for cruor

#

oh, wait, he closed discord t-

#

?

mellow frost
#

for context

unborn inlet
#

ah ok

mellow frost
#

@unborn inlet in the meantime try copy pasting the code from choiceDialog and modifying it to work, and to use table.unpack on the helpers.choice line

#

mmm but it uses some local functions

unborn inlet
#

ok, i'll try, but i have to run rn, i'll say if it works or not after about half-hour.

mellow frost
unborn inlet
#

It worked, thank you!

mellow frost
#

so that's the culprit here

#

okay

strong raptor
mellow frost
#

@unborn inlet

unborn inlet
#

i should replace zip in mods folder, right?

#

ok, launching celeste

unborn inlet
#

lua cutscenes has update

#

and my version is uhh newer?

#

didn't really see

#

ig it's ok

#

doesn't work

#

maybe i should try to redownload lua cutscenes?

#

no, same error.

mellow frost
#

it will replace the version you have with the one from gamebanana

#

which you don't want

unborn inlet
#

it didn't update because my version is newer radeline

mellow frost
#

automatic mod updates doesn't check the version

#

it literally just checks if your mod hash matches the one on gamebanana

  • some people forget to update their everest.yaml
  • some people don't do proper versioning
  • some other reasons
#

so if you have a 1.10.0 version of a mod, but the latest one is 1.9.0, the mod updater thinks 1.9.0 is a mod update and will ask you to replace your 1.10.0 version with 1.9.0, because it's the newest on gamebanana

unborn inlet
#

anyway i use dzhake.choiceDialog() because after redownload choiceDialog() didn't work

mellow frost
#

@strong raptor the offending line is still the same laugheline

#

the only difference is that line 261 has table.unpack

unborn inlet
#

uhh question.. what for? We know it'll work?

#

just "test anyway"?

#

(sure)

mellow frost
#

i'm just wondering if the modification i did will work

unborn inlet
#

why shouldn't it?

mellow frost
#

from what i see cruor added some special handling to helpers.choice in case the first and only argument is a table

#

that still crashes nlua from what i see

unborn inlet
#

oh, wai,t it would take a while..

#

i deleted everything

#

english txt, cutscene

mellow frost
unborn inlet
#

i didn't like it

mellow frost
#

reading the stacktrace from the crash it has something to do with NLua.MetaFunctions.CreateParamsArray

unborn inlet
#

huh? why does it work?

#

if choices are not table

#

it uses table.unpack() anyway?

#

oh wait.

#

ok.

mellow frost
#

the problem is that choiceDialog doesn't

unborn inlet
#

then.. why it doesn't work?

mellow frost
#

well, because choiceDialog calls choice without table.unpack

#

so i suspect the crash occurs while calling a vararg function without table.unpack

unborn inlet
#

vararg

#

...?

mellow frost
#

varargs in lua are ... from what i see

unborn inlet
#

(soo... fix is adding some random value like {},"fgladjflkgjlakf"?)

mellow frost
#

no, the fix here is to make choiceDialog call choice with table.unpack

#

at least i think so

unborn inlet
#

oh, so, do you really want me to test?

mellow frost
#

line 261 is the culprit
first screenshot is what the original has
second is what i changed

unborn inlet
#

i'm just toooo lazy to rewrite them all

mellow frost
#

just check if

choiceDialog({
  -- insert some dialog ids, idk
})

works properly without crashing

unborn inlet
#

ok.

#

it does

#

hhm

#

it's repeatable

#

it should not be i think

#

just going to keep using my version cuz uhh

mellow frost
upbeat snow
mellow frost
#

it's not a nlua bug, just to be sure?

upbeat snow
#

I mean NLua is a jank piece of garbage and it should definitely handle this error better cluelesseline

#

But yeah no it isn't

#

That error always means "Lua code tried to invoke C# varargs function with incompatible argument type"

mellow frost
#

widergladeline1 ah

#

so wait

#

the issue would be in choice?

upbeat snow
#

I don't see why this wouldn't work thonkeline

mellow frost
#

this is the zip cruor sent

#

so i have no clue

mellow frost
#

so like, from what i see it just dies trying to call choice with a vararg function

#

?????

unborn inlet
#

ngl, i have only one question: lua cutscenes are so unpopular, that after using them for two days i already found a critical error?

unborn inlet
#

(choice didn't disappear after i selected it)

#

(maybe problem is what second dialog key didn't exist thinkeline )

mellow frost
#

just make your own cutscenes in c# cluegrin

unborn inlet
#

i want to use lua cuz uhh why not

strong raptor
#

worked on my machine :p

mellow frost
#

since the crashes seem to happen on core

strong raptor
#

literally installed core to test it haha

mellow frost
#

well then

candid zinc
#

catstare ran into the same issue and solved with the version above

unborn inlet