Skip to content

Commit bbea66e

Browse files
added activeImplementation for debugging purposes
1 parent 669d35a commit bbea66e

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

lua-simdjson-scm-0.rockspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ source = {
55
tag = "0.0.0"
66
}
77
description = {
8-
summary = "This is a simple Lua library for packing and unpacking binary data",
8+
summary = "This is a simple Lua binding for simdjson",
99
detailed = [[
10-
This is a simple Lua library for packing and unpacking binary data.
10+
This is a c++ binding to simdjson for parsing JSON very quickly.
1111
]],
1212
homepage = "https://github.com/FourierTransformer/lua-simdjson",
1313
license = "Apache-2.0"

src/luasimdjson.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,17 @@ static int parse_file(lua_State *L)
124124
return 1;
125125
}
126126

127+
static int active_implementation(lua_State *L)
128+
{
129+
std::string name = simdjson::active_implementation->name();
130+
std::string description = simdjson::active_implementation->description();
131+
std::string implementation_name = name + " (" + description + ")";
132+
133+
lua_pushlstring(L, implementation_name.data(), implementation_name.size());
134+
135+
return 1;
136+
}
137+
127138
// ParsedObject as C++ class
128139
#define LUA_MYOBJECT "ParsedObject"
129140
class ParsedObject{

src/luasimdjson.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
extern "C" {
33
static int parse(lua_State*);
44
static int parse_file(lua_State*);
5+
static int active_implementation(lua_State*);
56
static int ParsedObject_open(lua_State*);
67
static int ParsedObject_open_file(lua_State*);
78

89

910
static const struct luaL_Reg luasimdjson[] = {
1011
{"parse", parse},
1112
{"parseFile", parse_file},
13+
{"activeImplementation", active_implementation},
1214
{"open", ParsedObject_open},
1315
{"openFile", ParsedObject_open_file},
1416

0 commit comments

Comments
 (0)