14 January 2015

Error catched in scripts

Sorry to all, it's was really stupid error, in lua then you typing for example 3/2 result will 1.5 and I knew about it (it's common thing for languages with dynamic typing), but if you write string.rep("some string", 1.5) result will "some stringsome string" as you see it's repeated twice! Cause in lua float to integer working like int new_value = int(value + 0.5f) (in c/c++). You can fix your scripts easy, if you see this string in your scripts:
function s(n)return("r1"):rep(n/32)..("r32"):rep(n%32)end
or this string:
function s(n)return("r1"):rep(n/16)..("r16"):rep(n%16)end
change it to:
function s(n)return("r1"):rep(math.floor(n/32))..("r32"):rep(n%32)end
and respectively to:
function s(n)return("r1"):rep(math.floor(n/16))..("r16"):rep(n%16)end

NotesConvertor is going to be updated with that fix later.

No comments:

Post a Comment