corn-config / corn

🌽 A simple and pain-free configuration language. Reference libcorn implementation and CLI.
https://cornlang.dev
MIT License
40 stars 5 forks source link

feat(libcorn): libcorn Lua library export #20

Closed A-Cloud-Ninja closed 1 year ago

A-Cloud-Ninja commented 1 year ago

Introduces the structure for a Lua process to load libcorn.so

Currently when this compiles, it creates a liblibcorn.so which has to be renamed during use from a pure Lua perspective, to libcorn.so (this is an issue with how Lua looks for and loads libraries, rather than a rust problem directly)

JakeStanger commented 1 year ago

@A-Cloud-Ninja are you able to provide an example usage from Lua for this pls?

A-Cloud-Ninja commented 1 year ago

Absolutely

local libcorn = require("libcorn")
local res,t = pcall(libcorn.parse,'{foo="bar"}')
if res then
    print(t.foo)
else
    print(t)
end

Do you want this in a commit or is just this fine?

JakeStanger commented 1 year ago

Do you want this in a commit or is just this fine?

That's great, thanks :)

Let's see if I got the CI working first second third time...