Skip to content

l0.DependencyControl.helpers.ffi-windows

ffi_windows = require "l0.DependencyControl.helpers.ffi-windows"
local ffi_windows = require("l0.DependencyControl.helpers.ffi-windows")

Functions

toWide

ffi_windows.toWide s
ffi_windows.toWide(s)

Converts a UTF-8 string to a NUL-terminated wide-char (UTF-16) buffer for the *W Win32 APIs. Requires kernel32 to have loaded (see haveKernel32); errors otherwise.

param type description
s string A UTF-8 encoded string.

Returns:

  • buffer ffi.cdata* — A wchar_t[] buffer holding the converted, NUL-terminated string.

setConsoleOutputUTF8

ffi_windows.setConsoleOutputUTF8!
ffi_windows.setConsoleOutputUTF8()

Switches the attached console's output code page to UTF-8. Returns false if kernel32 is unavailable or no console is attached (output is redirected).

Returns:

  • ok boolean — Whether the output code page was switched to UTF-8.

Fields

field type description
kernel32 any
haveKernel32 boolean