fdsprod / twitch2dcs

DCS World mod that allows twitch chat to be viewed inside the game
MIT License
32 stars 9 forks source link

attempt to index field 'connection' (a nil value) - server.lua Line 38 #14

Open Camble opened 1 year ago

Camble commented 1 year ago

Intermittent error when starting DCS

"[string "C:\Users\username\Saved Games\DCS.openbeta\Scripts\twitch\server.lua"]:38: attempt to index field 'connection' (a nil value)"

Originally posted by @danw-eth in https://github.com/jeffboulanger/twitch2dcs/issues/13#issuecomment-1558213660

HangmanGlenn commented 3 months ago

i have got this issue an can not get it back to work again?

ozdeadmeat commented 2 months ago

i have got this issue an can not get it back to work again?

In my experience, if the error is popping up, you need to reauth to Twitch again. Give that a go and see if it works.

HangmanGlenn commented 2 months ago

I tried that 3 times an still does not work


From: OzDeaDMeaT @.> Sent: Thursday, July 25, 2024 4:23 PM To: fdsprod/twitch2dcs @.> Cc: HangmanGlenn @.>; Comment @.> Subject: Re: [fdsprod/twitch2dcs] attempt to index field 'connection' (a nil value) - server.lua Line 38 (Issue #14)

i have got this issue an can not get it back to work again?

In my experience, if the error is popping up, you need to reauth to Twitch again. Give that a go and see if it works.

— Reply to this email directly, view it on GitHubhttps://github.com/fdsprod/twitch2dcs/issues/14#issuecomment-2250451699, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BJXO254HJZEGYK2U6AASQYDZOEC55AVCNFSM6AAAAABLCL4FX6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJQGQ2TCNRZHE. You are receiving this because you commented.Message ID: @.***>

Camble commented 2 months ago

@HangmanGlenn is the line number 38? If not, it may be a different issue which was resolved, but not included in the latest release. If the line number is different, download the latest server.lua directly instead of from the GitHub releases.

HangmanGlenn commented 2 months ago

Yess the serverlua 38 is the fault code look so i have to download the server lua from the github page?


From: Kenny @.> Sent: Saturday, July 27, 2024 5:38 PM To: fdsprod/twitch2dcs @.> Cc: HangmanGlenn @.>; Mention @.> Subject: Re: [fdsprod/twitch2dcs] attempt to index field 'connection' (a nil value) - server.lua Line 38 (Issue #14)

@HangmanGlennhttps://github.com/HangmanGlenn is the line number 38? If not, it may be a different issue which was resolved, but not included in the latest release. If the line number is different, download the latest server.lua directly instead of from the GitHub releases.

— Reply to this email directly, view it on GitHubhttps://github.com/fdsprod/twitch2dcs/issues/14#issuecomment-2254181129, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BJXO253FI554LOOOXBIXMXLZOO5H3AVCNFSM6AAAAABLCL4FX6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJUGE4DCMJSHE. You are receiving this because you were mentioned.Message ID: @.***>

HangmanGlenn commented 2 months ago

also try that server.lua file does not work an together with this signed out my oauth en reconnect again stil no response an the server.lua 38 fault keeps poppin up..

HangmanGlenn commented 2 months ago

i also deleted the options.lua file like they say in the read.me an than i have to set all the settings again to how it was also for vr an all the other stuff it works for only that matter in game there is no server.lua fault but it also does'nt work(the in game chat). when i restart the game the server.lua 38 is back

Camble commented 2 months ago

The problem is that self.connection is nil when line 38 is executed

The only place I can see self.connection being set to nil is inside the Server:reset() function above. A bit of guesswork here, but above line 38, something like this could be added: if not self.connection then self.connection = socket.tcp() end

Or maybe Server:reset() should just do self.connection = socket.tcp(). Not sure what else this would impact. The code is called from here.

HangmanGlenn commented 2 months ago

Yess so i looked in the file an says:

function Server:new(hostAddress, port)       local server = base.setmetatable({}, Server_mt)

      server.connection = socket.tcp()       server.hostAddress = hostAddress       server.port = port

      return server end

function Server:reset()       self.connection = nil


From: Kenny @.> Sent: Sunday, July 28, 2024 2:25 PM To: fdsprod/twitch2dcs @.> Cc: HangmanGlenn @.>; Mention @.> Subject: Re: [fdsprod/twitch2dcs] attempt to index field 'connection' (a nil value) - server.lua Line 38 (Issue #14)

The problem is that self.connection is nil when line 38https://github.com/fdsprod/twitch2dcs/blob/efadfce4b20e002fb014c756ccb3642f42a07ca8/Scripts/twitch/server.lua#L38 is executed

The only place I can see self.connection being set to nil is inside the Server:reset() function above. A bit of guesswork here, but above line 38, something like this could be added: if not self.connection then self.connection = socket.tcp() end

— Reply to this email directly, view it on GitHubhttps://github.com/fdsprod/twitch2dcs/issues/14#issuecomment-2254500926, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BJXO252FQLER6PAPPE7CIIDZOTPLTAVCNFSM6AAAAABLCL4FX6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJUGUYDAOJSGY. You are receiving this because you were mentioned.Message ID: @.***>

HangmanGlenn commented 2 months ago

I tried this also reinstalled dcs but stil the 38 fault poppin up i also am not an good scripter tho haha


From: Kenny @.> Sent: Sunday, July 28, 2024 2:25 PM To: fdsprod/twitch2dcs @.> Cc: HangmanGlenn @.>; Mention @.> Subject: Re: [fdsprod/twitch2dcs] attempt to index field 'connection' (a nil value) - server.lua Line 38 (Issue #14)

The problem is that self.connection is nil when line 38https://github.com/fdsprod/twitch2dcs/blob/efadfce4b20e002fb014c756ccb3642f42a07ca8/Scripts/twitch/server.lua#L38 is executed

The only place I can see self.connection being set to nil is inside the Server:reset() function above. A bit of guesswork here, but above line 38, something like this could be added: if not self.connection then self.connection = socket.tcp() end

— Reply to this email directly, view it on GitHubhttps://github.com/fdsprod/twitch2dcs/issues/14#issuecomment-2254500926, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BJXO252FQLER6PAPPE7CIIDZOTPLTAVCNFSM6AAAAABLCL4FX6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJUGUYDAOJSGY. You are receiving this because you were mentioned.Message ID: @.***>

HangmanGlenn commented 2 months ago

https://1drv.ms/i/s!AmEeRdfMhqErbinKTMieI3EGpbw [https://snz04pap001files.storage.live.com/y4mpcBFh161Y2rwKikXbYbqTHsh52jLoOEs53GoPrOMO7ZmAnPfMQtubACUmXur10NXc6arbvxI6jmUL3SW7WW2XX45335RETPArk6Nd73jP9y7VdP-Z2_A2SGSjld_7cK8YKcm-sjCgSzoRKHCndafLwcUxJG4ajgqOlAK7MgcdRO-VzHl2r3ITLenYodBBowz?width=200&height=150&cropmode=center] [https://res.cdn.office.net/assets/mail/file-icon/png/cloud_blue_16x16.png]line 79 na 38 .png Line 38 is gone now comes line 70 like i said i reinstalled dcs an also twitch2dcs


From: Kenny @.> Sent: Sunday, July 28, 2024 2:25 PM To: fdsprod/twitch2dcs @.> Cc: HangmanGlenn @.>; Mention @.> Subject: Re: [fdsprod/twitch2dcs] attempt to index field 'connection' (a nil value) - server.lua Line 38 (Issue #14)

The problem is that self.connection is nil when line 38https://github.com/fdsprod/twitch2dcs/blob/efadfce4b20e002fb014c756ccb3642f42a07ca8/Scripts/twitch/server.lua#L38 is executed

The only place I can see self.connection being set to nil is inside the Server:reset() function above. A bit of guesswork here, but above line 38, something like this could be added: if not self.connection then self.connection = socket.tcp() end

— Reply to this email directly, view it on GitHubhttps://github.com/fdsprod/twitch2dcs/issues/14#issuecomment-2254500926, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BJXO252FQLER6PAPPE7CIIDZOTPLTAVCNFSM6AAAAABLCL4FX6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJUGUYDAOJSGY. You are receiving this because you were mentioned.Message ID: @.***>