Page 1 of 1
Reasons to hold on to the mikrotik specific scripting language
Posted: Tue Mar 07, 2023 9:27 pm
by mischa01101
Hi,
after using the mikrotik scripting language I wonder why Mikrotik holds on to this archaic and painful language. It is widely known that there are small and useful alternatives like LUA or Micropython. I saw that LUA was supported in some Betas and then again dropped in some 4.X release. Is there anybody with more insights into this topic and could explain why in 2023 we seem to be stuck in the 80s with what we get for scripting? Having TCL on the Cisco back in the days was more comfortable than what we have here. And even if there needs to backward compatibility there seems to be enough flash in all newer devices with 7.x to have LUA or Micropython as an alternative.
Thanks,
Mischa
Re: Reasons to hold on to the mikrotik specific scripting language
Posted: Tue Mar 07, 2023 10:06 pm
by infabo
amen
Re: Reasons to hold on to the mikrotik specific scripting language
Posted: Wed Mar 08, 2023 12:22 am
by rextended
Wait September and you will have a surprise with RouterOS v7.11.9...
Re: Reasons to hold on to the mikrotik specific scripting language
Posted: Wed Mar 08, 2023 1:28 am
by mozerd
@Mischa
Spot on ….
Re: Reasons to hold on to the mikrotik specific scripting language
Posted: Wed Mar 08, 2023 3:08 am
by Amm0
You're talking to a guy who bought his first Mikrotik specifically because I loved the idea of Lua being integrated with config. But since they didn't update their web pages, the unit I got didn't support Lua anymore...but totally unclear if your just read the wiki/webpage.
But I personally find the current scripting language one the greatest assets of RouterOS. It completely integrated with config scheme, which is a set of tables that you manipulate it. If you knew functional programming like LISP etc, their language makes a lot more sense. That just do go all the way, and left things at 80% done, like a lot of the other features.
So agree it's missing a few functions to make it more "user friendly" – no argument – but add some and fix it! You'd have to change how all CLI works for some newer scripting language, and it that may come out worse (see the new BGP scripting language). It hard to both be a good script language and also have a good REPL at same time (see JavaScript).
And, I think the container so this need today – use what ever language. Most modern languages have a library for both REST and API & unless you explain how you'd doing normal CLI config with micropython or Lua, I'm skeptical.
What is about the current scheme that is so limiting that requires wholesale replacement, vs add some missing functions (like JSON, unicode)? How are you sure it wouldn't be worse...
Re: Reasons to hold on to the mikrotik specific scripting language
Posted: Wed Mar 08, 2023 4:33 am
by Sob
Add few built-in functions for convenience, find a way to provide more feedback on errors than silent death, and I'll be willing to say that it's ok.
Re: Reasons to hold on to the mikrotik specific scripting language
Posted: Sun Apr 02, 2023 12:23 pm
by mischa01101
Wait September and you will have a surprise with RouterOS v7.11.9...
This is hopefully a "self-fulfilling prophecy" or do you have inside details on what could be possible?
Re: Reasons to hold on to the mikrotik specific scripting language
Posted: Sun Apr 02, 2023 12:25 pm
by DarkNate
A work-around is to use your own programming language of choice and call the API to fetch/change things. Run code outside the router.
Re: Reasons to hold on to the mikrotik specific scripting language
Posted: Sun Apr 02, 2023 12:34 pm
by mischa01101
And, I think the container so this need today – use what ever language. Most modern languages have a library for both REST and API & unless you explain how you'd doing normal CLI config with micropython or Lua, I'm skeptical.
The problem with containers is that they are not supported on all architectures and especially switches that lack enough ram and flash.
I tried to implement a mechanism where mikrotik network devices are deployed with a set of tools that allow them to connect to a central controller, look for its config, apply what is given (in this case json data) and apply this to the local device. The controller supports many more platforms than mikrotik so staying with a provider independent format (json) was a given requirement. When trying to implement a robust solution the current scripting language really showed - at least for me - that the lack of sane error handling, the way functions and variable handling is done, the data structures available, ... just make this potentially simple task very hard. That said writing the same code in python or lua is a really fast, save and pleasant experience. But YMMV/
Re: Reasons to hold on to the mikrotik specific scripting language
Posted: Sun Apr 02, 2023 3:29 pm
by zainarbani
Make Busybox accessible
Re: Reasons to hold on to the mikrotik specific scripting language
Posted: Sun Apr 02, 2023 6:05 pm
by Amm0
Make Busybox accessible
I think folks forget some of these devices have very low memory/disks, which makes adding stuff tricky. And there is no busybox under-the-covers to even expose. busybox assumes the underlying files/system is exposed, which hasn't been Mikrotik's philosophy to allow. Kinda think if managing the underlying OS is what you want to do, flashing OpenWRT seems like a better approach...than trying to make RouterOS more like OpenWRT.
NOW if you asking if Mikrotik should map more of the POSIX/"busybox" into RouterOS equivalents, different question. And think some progress on the multiyear request list for
more built-ins function into the scripting language would go a long way to making the scripting better, than replacing it.
Re: Reasons to hold on to the mikrotik specific scripting language
Posted: Mon Apr 03, 2023 3:19 pm
by usern
Proper support for functions would be greatly appreciated. I could not get the current "variable calling" to work with nested "function calls".
Re: Reasons to hold on to the mikrotik specific scripting language
Posted: Mon Apr 03, 2023 4:18 pm
by rextended
Proper support for functions would be greatly appreciated. I could not get the current "variable calling" to work with nested "function calls".
Open separate topic (if you do not have already done that), for see what is the problem.
Re: Reasons to hold on to the mikrotik specific scripting language
Posted: Sun Dec 01, 2024 8:16 pm
by protagonista
I have seen devices 100 times more primitive running Lua. Of course it is easy to say "just add bindings", but well... Even the task of filtering simple ip lists becomes a North Pole expedition on Routeros, it should not be so.