Using BearLibTerminal with Lua is very straightforward. The library binary file itself is a Lua binary module which may be imported by a simple require instruction:
terminal = require 'BearLibTerminal' -- Initialize the library terminal.open() -- Print something terminal.print(2, 1, 'Hello, world') terminal.refresh() -- The usual 'Press any key to exit...' terminal.read() -- Clean up terminal.close()
For this to work, you must:
Similar to other bindings, functions and constants names and their behavior are mostly the same as described at API reference page. The fact that most of library configuration is text-based helps this a lot.
The only noticeable difference is that read str function returns two values instead of one:
rc, str = terminal.read_str(x, y, prompt_str, max_length)