A binding to libqalculate for lua
Go to file
Yessiest e68aa525e0 Merge branch 'ubuntu-lts' 2022-05-27 23:44:36 +04:00
.gitignore Added .gitignore 2022-05-20 22:11:02 +04:00
LICENSE Add 'LICENSE' 2022-04-09 19:11:50 +00:00
Makefile Changed default version to 5.1 2022-05-20 22:13:59 +04:00
README.md Changed default version in readme 2022-05-20 22:18:16 +04:00
qalculator.cpp Added more tests, more parameters, fixed interval handling 2022-05-27 23:44:10 +04:00
test.lua Added more tests, more parameters, fixed interval handling 2022-05-27 23:44:10 +04:00

README.md

luaqalculator

This library implmenets some glue between libqalculate and lua, which is used for my bot's calculate function. Calling this library a "binding" would probably be a mistake seeing that it simply isn't a binding, but rather a thin library that allows calling the "CalculateAndPrint" function from lua. That being said, it's more than enough for my particular use case.

Building

To make everything to compile with as few steps as possible you will need make, g++, libqalculate and lua5.1 (which is the default target).

Once you have all of the above, simply type make and it will produce the needed libqalcaulator.so library. If you wish to compile against a different version, simply change the variable LUA_VERSION in the makefile to the one you need.

Usage

qalc = require("libqalculator")
print(qalc.qalc("sin(3 rad)")) -- Approximate mode (will return an interval with approximate values)
print(qalc.qalc("sin(3 rad)", true)) -- Exact mode (will return "sin(3 rad)" to avoid approximation)

License

This project is licensed under the MIT license (located in the LICENSE file)