Getting error [string "line"]:4: attempt to call global 'rank' (a nil value)

Moderator: leecollings

Post Reply
Deepak
Posts: 1
Joined: Friday 04 June 2021 23:57
Target OS: -
Domoticz version:
Contact:

Getting error [string "line"]:4: attempt to call global 'rank' (a nil value)

Post by Deepak »

Can someone please let me know the reason behind this error? I am punching ranking grid question to hidden multi punch question.

Error: [string "line"]:4: attempt to call global 'rank' (a nil value)

Programming code:
rank = tonumber(rank)
q11_1=tonumber(rank("Q11_001"))
print(q11_1)
sel={}

if in_array("1",q11_1) or in_array("2",q11_1) or in_array("3",q11_1) then
print(option1)
table.insert(sel,"1")
end

print(sel)
setvalue("MRK_Q11",sel)

Any help would be really appreciated! Thank you.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Getting error [string "line"]:4: attempt to call global 'rank' (a nil value)

Post by waaren »

Deepak wrote: Saturday 05 June 2021 0:04 Can someone please let me know the reason behind this error? I am punching ranking grid question to hidden multi punch question.
Error: [string "line"]:4: attempt to call global 'rank' (a nil value)
In line

Code: Select all

rank = tonumber(rank)

You made the script variable rank a number (or nil if rank could not be converted to a number.

In the next code line you try to all rank as a function.

Code: Select all

q11_1=tonumber(rank("Q11_001"))
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest