| Time |
Nick |
Message |
| 00:28 |
|
ShadowBot joined #minetest-dev |
| 00:57 |
MTDiscord |
<jordan4ibanez> imi couldn't is_digit compare against a table that holds a bunch of strings in which are numeric in value or regex via local number_chars = {"0","1","2","3","4","5","6","7","8","9"} then just do a function is_digit(c) for _,char in ipairs(number_chars) do if c == char then return true end end return false end? |
| 01:09 |
|
YuGiOhJCJ joined #minetest-dev |
| 01:33 |
|
jonadab joined #minetest-dev |
| 02:04 |
|
Soni joined #minetest-dev |
| 04:00 |
|
MTDiscord joined #minetest-dev |
| 04:41 |
|
calcul0n joined #minetest-dev |
| 05:37 |
pgimeno |
that parse file needs some work to avoid generating too much garbage |
| 05:37 |
pgimeno |
it should be using pointers instead of creating new strings |
| 05:38 |
pgimeno |
as for is_digit, c >= "0" and c <= "9" is definitely faster than about any other alternative, although it assumes that c is exactly 1 byte long (which is a reasonable assumption in this context) |
| 06:46 |
MTDiscord |
<luatic> just use Lua patterns |
| 06:55 |
|
appguru joined #minetest-dev |
| 07:15 |
pgimeno |
Lua patterns are too powerless for many parsing operations |
| 07:23 |
|
appguru joined #minetest-dev |
| 08:52 |
|
hmmmm joined #minetest-dev |
| 09:53 |
|
appguru joined #minetest-dev |
| 09:56 |
|
pmp-p joined #minetest-dev |
| 10:07 |
MTDiscord |
<luatic> agreed |
| 10:08 |
MTDiscord |
<luatic> yet they can very well be used to for example detect whether something is a digit, or extract a string of digits |
| 10:08 |
MTDiscord |
<luatic> typically the "workaround" is to use overly permissive patterns, then leave further validation to the Lua code |
| 10:08 |
MTDiscord |
<luatic> for example using an overly permissive float pattern, then using tonumber to check whether it is indeed a valid number |
| 10:10 |
MTDiscord |
<luatic> imi's code can be rewritten to be more readable and more efficient using patterns, while exactly preserving functionality |
| 10:14 |
|
imi joined #minetest-dev |
| 10:17 |
imi |
hi, this would be a pretty useful chatcmd_parse_coords function to make chatcommands handle coordinates in an uniform way: https://onecompiler.com/lua/3zbcseyh7 what do you think? |
| 10:24 |
|
appguru joined #minetest-dev |
| 10:40 |
|
proller joined #minetest-dev |
| 12:02 |
|
qur joined #minetest-dev |
| 12:27 |
|
olliy joined #minetest-dev |
| 12:40 |
|
tekakutli joined #minetest-dev |
| 12:52 |
|
josh_ joined #minetest-dev |
| 13:01 |
|
proller joined #minetest-dev |
| 13:04 |
|
natewrench joined #minetest-dev |
| 13:17 |
pgimeno |
imi: there's been some discussion while you were away, please look at https://irc.minetest.net/minetest-dev/2023-06-12#i_6090627 until you joined again |
| 13:26 |
imi |
https://www.lua.org/pil/20.2.html as far as I can tell this is a slightly extended regexp |
| 14:16 |
pgimeno |
patterns are definitely less powerful than regexps |
| 14:17 |
pgimeno |
e.g. you can check if a date is valid with a regexp, but not with a pattern |
| 14:55 |
|
appguru joined #minetest-dev |
| 15:01 |
MTDiscord |
<luatic> imi, pgimeno: patterns are both less powerful (no alternation & grouping, only capture groups) and more powerful (bracket matching) than regex |
| 15:36 |
imi |
ok, next versin of my code: https://onecompiler.com/lua/3zbde65gd |
| 16:25 |
|
natewrench joined #minetest-dev |
| 16:39 |
|
Desour joined #minetest-dev |
| 17:00 |
|
appguru joined #minetest-dev |
| 17:15 |
|
v-rob joined #minetest-dev |
| 17:17 |
|
rubenwardy joined #minetest-dev |
| 18:01 |
|
bigfoot547 joined #minetest-dev |
| 18:39 |
|
v-rob joined #minetest-dev |
| 19:17 |
pgimeno |
er, when looking up what the tilde notation does in lua_api, I saw that no one seemed to notice that in markdown, the tilde is used for strikeout |
| 19:17 |
pgimeno |
sorry that I can't open an issue |
| 19:18 |
pgimeno |
not sure if this link will work: https://github.com/minetest/minetest/blob/master/doc/lua_api.md#user-content-helper-functions |
| 19:19 |
pgimeno |
in the explanation of string_to_area |
| 20:40 |
|
appguru joined #minetest-dev |
| 20:44 |
|
tekakutli joined #minetest-dev |
| 21:03 |
|
natewrench joined #minetest-dev |
| 22:34 |
|
panwolfram joined #minetest-dev |