Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function to set a variable remembering only the integer part
- local function setIntegerVariable(varName, value)
- if type(value) == "number" then
- _G[varName] = math.floor(value)
- else
- print("Error: Value is not a number.")
- end
- end
- -- Example usage:
- local myVar = 12.34
- setIntegerVariable("myVar", myVar)
- -- Accessing the variable
- print(myVar) -- Output: 12
Advertisement
Add Comment
Please, Sign In to add comment