Carbonite Quests

Carbonite Quests

612k Downloads

10846 local _ <--- What does this mean : NxQuest.lua

Thrumbar opened this issue ยท 5 comments

commented

function Nx.Quest:BuildComSend()

local _
local cur = self.Watch.ClosestCur
local obj = 0
local flgs = 2			-- Not a targeted quest flag

if self.QLastChanged then	-- Quest change? Com nils this once send to zone

	cur = self.QLastChanged

-- Nx.prt ("Q Send Change %s", cur.Title)

else
	local typ, tid = Nx.Map:GetTargetInfo()
	if typ == "Q" then

		local qid = floor (tid / 100)
		_, cur = self:FindCur (qid)
		obj = tid % 100
		flgs = 0
	end
end

if cur then

	if cur.Complete then
		flgs = flgs + 1
	end

	local str = format ("%04x%c%c%c", cur.QId, obj+35, flgs+35, cur.LBCnt+35)

	for n = 1, cur.LBCnt do

		local s1, _, cnt, total = strfind (cur[n], "(%d+)/(%d+)")
		if s1 then
			total = tonumber (total)
			if total > 50 then
				cnt = cnt / total * 60
				total = 60
			end
			cnt = cnt + 2
		else
			cnt = 0
			if cur[n + 100] then		-- Done?
				cnt = 1
			end
			total = 0
		end

		str = str .. format ("%c%c", cnt + 35, total + 35)
	end

-- Nx.prt ("QSend %s", str)

	return str, 4
end

return "", 0

end

commented

Its used to skip variables that are not used or not needed at some point, like:

local s1, _, cnt, total = strfind (cur[n], "(%d+)/(%d+)")

_, cur = self:FindCur (qid)
commented

Question is what does it mean in said usage ??? No variables mentioned..

commented

local _ define local variable named "_"

commented

Thanks..

commented

No problem :)