function::set_ulonglong_arg - Linux
Overview
The function::set_ulonglong_arg
command is used to set the value of a uint64_t argument in a function from Lua. It allows you to pass native Lua numbers larger than the usual 32-bit integer limit to C functions.
Syntax
function::set_ulonglong_arg(function_handle, number_to_set)
Parameters
- function_handle: The handle of the function to set the argument for.
- number_to_set: The uint64_t value to set the argument to.
Options/Flags
None.
Examples
-- Getting a function handle
local function_handle = function::lookup("myAmazingFunction", "myModule")
-- Setting the 64-bit argument
function::set_ulonglong_arg(function_handle, 12345678901234567890)
-- Calling the function
local result = function::call(function_handle)
Common Issues
Make sure to pass a uint64_t value to function::set_ulonglong_arg
. If you attempt to pass a Lua number larger than 2^53-1 (the largest representable IEEE 754 double-precision floating-point number), only the lower 53 bits will be set.
Integration
The function::set_ulonglong_arg
command can be combined with other Lua functions to create powerful scripts and integrations. For example, it can be used to interact with C libraries that require passing 64-bit integers.
Related Commands
function::set_float_arg
: Sets the value of a float argument in a C function.function::call
: Calls a function with the previously set arguments.