Forum

> > CS2D > Scripts > [Lua Problem] An error I refuse to understand
Forums overviewCS2D overview Scripts overviewLog in to reply

English [Lua Problem] An error I refuse to understand

2 replies
To the start Previous 1 Next To the start

old [Lua Problem] An error I refuse to understand

EngiN33R
Moderator Off Offline

Quote
The code: http://pastebin.com/PjyD373S

Apparently an error appears on the line 50, 'attempt to concatenate a nil value'. I refuse to understand it because the debug messages that show the functions' return values show them okay and nothing else can theoretically be nil. I tried restarting the game (CS2D can sometimes glitch up a bit) - no effect. Please help if you can. I'll provide all the necessary extra info.

old Re: [Lua Problem] An error I refuse to understand

Lee
Moderator Off Offline

Quote
Doesn't seem like you've tested getweapon with n+(8*(p-1)) for n>1.

Since getweapon is
1
2
3
4
5
function getweapon(b,n)
	if (basedata[b].hardware[n]~=nil) then
		return equipment[basedata[b].hardware[n].type].name.."|"..equipment[basedata[b].hardware[n].type].price
	end
end

this returns nil if basedata[b].hardware[n] is nil.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview