Language: 
To browser these website, it's necessary to store cookies on your computer.
The cookies contain no personal information, they are required for program control.
  the storage of cookies while browsing this website, on Login and Register.

Author Topic:  plane crash  (Read 632 times)

0 Members and 1 Guest are viewing this topic.

_people_

« on: 04, September 2020, 11:16:08 »
Code: [Select]
LUA-CH:MW:`|Daimonin|` >...s//planes/human_plane/islands/gr_islands_airport.lua:66: attempt to concatenate local 'count' (a nil value)
me=~boarding stairs[3048504] ~
activator=~Valcandos[2917348] ~
other=nil
message=~""~
options=~"5"~
stack traceback:
../maps/lua/plugin_init.lua:203: in function <../maps/lua/plugin_init.lua:156>
[C]: ?
...s//planes/human_plane/islands/gr_islands_airport.lua:66: in main chunk<

Haven't had time to look at this but I've just spotted it in the chat logs. IDK how it was triggered but I can check the tech logs when I get home.
-- _people_ :)

grommit

« Reply #1 on: 04, September 2020, 12:13:49 »
Mine! Will check out now.

(Please contact me for any islands problems.)

This is the code in question:
Code: [Select]
local count -- used in cabin leg

count = ds:Get("flight_attendant") -- count used as temporary variable here.
if not count or count == 1 then    -- if count is 1, player logged out while
                                   -- talking to flight attendant, so reset.
    ds:Set("flight_attendant", 0)
end
TRACE ("flight_attendant = "..count)

Line 66 is the TRACE statement. Tracing is off - but presumably Lua parses the statement first regardless.  Maybe that's a booboo on my part: assuming a nil quantity  tests false (must check that in doc).

Just before that I have this code, where I test explicitly for a nil value:
Code: [Select]
local flight_state = ds:Get("flight_state")
if flight_state == nil then
    flight_state = 0
    ds:Set("flight_state", 0)
end

No excuse for this sloppiness and I will now get out my cat of nine tails and chastise myself, Game of Thrones style.

Just found this in Stack Overflow: https://stackoverflow.com/questions/47963048/why-does-not-nil-return-true-in-lua
Guy asks why not nil returns true, and gets the answer "What do you expect it to return?"  :)

Will fix right away and commit. Will require a reboot of course - if no one is on I'll do that. (Haven't worked out the syntax to reduce the time from the default 5 minute countdown yet.)
« Last Edit: 04, September 2020, 12:30:56 by grommit »

grommit

« Reply #2 on: 04, September 2020, 14:44:28 »
_people_: Puzzled by the activator in your quoted log - user Valcandos doesn't appear to exist.

Ah! Forum member names != player names. Wanted to PM that player to apologise and say it was now fixed. The disconnect is unhelpful.
« Last Edit: 04, September 2020, 14:53:27 by grommit »

Tags:
 

Related Topics

  Subject / Started by Replies Last post
14 Replies
3607 Views
Last post 23, September 2006, 03:02:45
by Unislash
6 Replies
1388 Views
Last post 01, September 2006, 07:40:24
by Unislash
3 Replies
926 Views
Last post 16, March 2007, 18:32:45
by Talwoasc