Open snakelet-Ling opened 9 months ago
string.gsub is somehow implemented, but full of mistakes. For example if the optional maximum number of replacements is not specified, this is set to -1, resulting in no replacement at all. And the counting of the offsets of the replacements is completeley wrong. Both would probably be not too complicated to fix, but I use my own version (with luaState.register("gsub", myDartGsubVersion) just calling dart's replaceAll function) instead.
You find all available lua functions in lib/src/stdlib/*.dart. Also string.match is there, I didn't check that one for mistakes.
Thanks for opening this issue, I've been wrapping my head around why string.match doesnt work... Does anyone know if this is difficult to implement?
string.gsub is somehow implemented, but full of mistakes. For example if the optional maximum number of replacements is not specified, this is set to -1, resulting in no replacement at all. And the counting of the offsets of the replacements is completeley wrong. Both would probably be not too complicated to fix, but I use my own version (with luaState.register("gsub", myDartGsubVersion) just calling dart's replaceAll function) instead.
You find all available lua functions in lib/src/stdlib/*.dart. Also string.match is there, I didn't check that one for mistakes.
Thanks for your answer, I just have time to check it out. I solved this problem using the same method as you...seriously, it's so much easier for me to write my own!
Thanks for opening this issue, I've been wrapping my head around why string.match doesnt work... Does anyone know if this is difficult to implement?
Like @thauschildt , the current solution is to write it yourself and then import it into Lua for use. My method is to pre-set a table to call the dart function every time before reading and calling the lua file, and then call it in the lua file as if using lib.
Interesting, I will check it out. Not sure if I got it correct but I will try and let you know.
I've tried using string.gsub, string.match neither work, they return the very beginning like nothing is run. I also tried replacing the first parameter with a colon, but it didn't work either.
I would like to ask if there are any Lua functions that can be used in this library?