Artifact 9bbacd41f1c81b2195f18299a42fdb1f787df671138a4cd6b253e2bb2a7f7118:
- File bind/strutils.c — part of check-in [b4009ca1bd] at 2024-05-07 19:25:37 on branch trunk — unbreak build (oops sorry about that) (user: lexi, size: 514) [annotate] [blame] [check-ins using]
#include "bind.h" _luafn(rangematch) { luaL_checkstring(l, 1); luaL_checknumber(l, 2); luaL_checkstring(l, 3); size_t strl = 0, matl = 0, start = lua_tointeger(l, 2)-1; const char* str = lua_tolstring(l, 1, &strl); const char* mat = lua_tolstring(l, 3, &matl); size_t to; if (start > strl || (to = start + matl) > strl) { _luaret_bool(false); } for (size_t i = start; i<to; ++i) { if (str[i] != mat[i - start]) _luaret_bool(false); } _luaret_bool(true); } _luaAPI(strutils, _export(rangematch));