sol2 icon indicating copy to clipboard operation
sol2 copied to clipboard

Generating definition files

Open UltraEngine opened this issue 2 years ago • 2 comments

We are looking to create definition files for our Lua 5.4 API like this: https://luals.github.io/wiki/definition-files/

We have about 800 commands, so we hope to find an automated solution for this.

I was wondering if there is a way to walk through a sol state and print out all the class structure, functions, etc. that are exposed to Lua?

UltraEngine avatar Apr 20 '24 14:04 UltraEngine

Hi! We are also a project using sol2 to create Lua bindings for our API. We maintain our API definitions as Lua files, from which a Lua script generates LuaLS autocomplete definition files. We've got a Lua script that reads our C++ source files and tries to find missing definition files: https://github.com/MWSE/MWSE/blob/master/autocomplete/builders/youforgotsomething.lua It's got some false positives and negatives. Maybe that could be useful to you. I don't know of a way that sol itself would provide info needed to build LuaLS definitions at runtime.

C3pa avatar Oct 06 '24 11:10 C3pa

@UltraEngine This issue was asked before if I remember correctly. Code/doc generation clearly falls out of this library's scope. So your best bet is to write a helper along the wrapped functions just as @C3pa did, unless you have an automated binding generation solution.

deadlocklogic avatar Oct 07 '24 07:10 deadlocklogic