There is no data type casting conversion feature available in LUA so an alternative to convert float values to integer would be to use the math library.

Lua

1

math.floor(variable)

This returns the largest integer smaller than or equal to the value.

Here is a simple method for getting the percent of a subtotal from the total. If you noticed in the code, I had to cast both the subtotal and total variables to float before casting the final result to an int.

This is because if you divide two numbers and both are of type int, the result will also be an int. Casting both variables to float before dividing them did the trick.