Page 1 of 1

Found a small bug

Posted: Fri Nov 27, 2015 9:53 am
by BlubBlab
I found something odd

In camera.lua

Code: Select all

  local proc = getProc();
  local memerrmsg = "Failed to read memory";
  self.XUVec = debugAssert(memoryReadFloat(proc, self.Address + camXUVec_offset), memerrmsg);
  self.YUVec = debugAssert(memoryReadFloat(proc, self.Address + camYUVec_offset), memerrmsg);
  self.ZUVec = debugAssert(memoryReadFloat(proc, self.Address + camZUVec_offset), memerrmsg);
  .
I wondered what the debugAssert function is :

Code: Select all

if(settings.options.DEBUGGING == nil ) then settings.options.DEBUGGING = false; end;
function debugAssert(args)
	if( settings.options.DEBUGGING ) then
		if( not args ) then
			error("Error in memory reading", 2);
		else
			return args;
		end
	else
		return args;
	end
end
If you don't see it the numbers of arguments don't match. For me it looks like either the error message should be optional or since it is a assert, "Failed to read memory" was originally expected as return value so you could assert against it but I would as return value more true or false expecting rather then the result... so no clue ?

I think I will add debug options to my InputOutput class but not like this.^^ (hm I still wonder if I should use Lisa's logger?)