Tointeger

Can we use either of these?

http://snippets.luacode.org/sputnik.lua?p=snippets/Number_to_Integer_Value_71

function toInteger(number)  
 return math.floor(number)  
end  
toInteger = math.floor  

trying to convert an incoming float (0.001 to 1) to an integer and this is what I have found so far.

This is what I got so far, it looks like I need some kind of checking somewhere i think:

add_global_action {  
pattern = "/sample/loop_end",  
description = "float",  
  
arguments = { argument("loop_end", "number") },  
handler = function(loop_end)  
local sample = renoise.song().selected_sample;  
local numberFrames = sample.sample_buffer.number_of_frames;  
local minY = 1;  
local max = numberFrames;  
local maxY = math.ceil(max)  
  
sample.loop_end = clamp_value(loop_end, minY, maxY)  
end  
}  

The way I have it, it looks like I need something more for both minY & maxY to understand I want to give it a float.
Taking numberFrames that uses integers to use or accept a float from the viewbuilder’s xypad.
From what I can tell from other’s work I need to be using if, then & else to do some checking.
I should be getting my beginning lua book in the mail sometime this week or next so I should be able to begin understanding these orbiting concepts.