I was just thinking about something simple like this:
static int tolua_RegexMatch(lua_State * tolua_S) { cLuaState S(tolua_S) if ( !S.CheckParamString(1, 2) ) { return 0; } AString str, regexstring, res; L.GetStackValues(1, str, regexstring); std::regex reg(regexstring); res = std::regex_match(str, reg); L.Push(res); } /// //... /// tolua_beginmodule(tolua_S, "cRegex"); tolua_function(tolua_S, "Match", tolua_RegexMatch); tolua_endmodule(tolua_S);