我有这个功能,我想返回多个值,但我不知道如何实现
function GetDiskSpace(_disk)
require("alien")
local kernel32 = alien.load("kernel32.dll")
kernel32.GetDiskFreeSpaceExA:types("int", "pointer", "int", "int", "int")
if kernel32.GetDiskFreeSpaceExA(_disk, _avail_space, _disk_space, _free_space) ~= 0 then
return _avail_space, _disk_space, _free_space
--[[or like this return kernel32.GetDiskFreeSpaceExA(_disk, _avail_space, _disk_space, _free_space)
GetDiskFreeSpaceExA should retun non zero if function ran properly,
and should retun additional values if those are given
(btw values are __int64 i'm not sure if I specified them correct, maybe
I should set them as "long" instead of "int")
either way it return only function value and nil's.
--]]
else
print("GetDiskSpace returned error.")
end
end
hdd_a, hdd_b, hdd_c = GetDiskSpace("C:\\")