From 8de229087f3d6ce6d1fb53fc91a5f97fb7f82ccc Mon Sep 17 00:00:00 2001 From: sonoro1234 Date: Tue, 24 Feb 2026 11:03:42 +0100 Subject: [PATCH] constants work 2 --- generator/cpp2ffi.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/generator/cpp2ffi.lua b/generator/cpp2ffi.lua index d18f9ca..01d23d3 100644 --- a/generator/cpp2ffi.lua +++ b/generator/cpp2ffi.lua @@ -2363,6 +2363,15 @@ function M.Parser() print(it.item) end end + elseif it.re_name == "vardef_re" then + local it2 = it.item:gsub("constexpr","static const") + if it2:match"static const" then + local name, assig = it2:match("static const %s*.+%s+([%w_]+)%s*=%s*([^;]*);") + --print(it2,name,assig) + if name and assig then + self.constants[name] = assig + end + end end elseif it.re_name == "enum_re" then enums_for_table(it, outtab, enumsordered)