Lua: tweaks and fixes

This commit is contained in:
Zef Hemel
2025-01-25 08:29:11 +01:00
parent 6f3d021da7
commit 236b2a7fdd
9 changed files with 76 additions and 23 deletions
+10
View File
@@ -1,4 +1,5 @@
import {
jsToLuaValue,
LuaBuiltinFunction,
luaCall,
LuaMultiRes,
@@ -213,4 +214,13 @@ export const stringApi = new LuaTable({
trim_end: new LuaBuiltinFunction((_sf, s: string) => {
return s.trimEnd();
}),
match_regex: new LuaBuiltinFunction((_sf, s: string, pattern: string) => {
const regex = new RegExp(pattern);
const result = s.match(regex);
return jsToLuaValue(result);
// if (!result) {
// return new LuaMultiRes([]);
// }
// return new LuaMultiRes(result.slice(1));
}),
});