Community discussions

MikroTik App
 
mischa01101
just joined
Topic Author
Posts: 8
Joined: Wed Feb 08, 2023 12:31 pm

Reasons to hold on to the mikrotik specific scripting language

Tue Mar 07, 2023 9:27 pm

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
 
infabo
Long time Member
Long time Member
Posts: 670
Joined: Thu Nov 12, 2020 12:07 pm

Re: Reasons to hold on to the mikrotik specific scripting language

Tue Mar 07, 2023 10:06 pm

amen
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12001
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Reasons to hold on to the mikrotik specific scripting language

Wed Mar 08, 2023 12:22 am

Wait September and you will have a surprise with RouterOS v7.11.9...
 
User avatar
mozerd
Forum Veteran
Forum Veteran
Posts: 887
Joined: Thu Oct 05, 2017 3:39 pm
Location: Canada
Contact:

Re: Reasons to hold on to the mikrotik specific scripting language

Wed Mar 08, 2023 1:28 am

@Mischa
Spot on ….
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3423
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: Reasons to hold on to the mikrotik specific scripting language

Wed Mar 08, 2023 3:08 am

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...
 
Sob
Forum Guru
Forum Guru
Posts: 9120
Joined: Mon Apr 20, 2009 9:11 pm

Re: Reasons to hold on to the mikrotik specific scripting language

Wed Mar 08, 2023 4:33 am

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. ;)
 
mischa01101
just joined
Topic Author
Posts: 8
Joined: Wed Feb 08, 2023 12:31 pm

Re: Reasons to hold on to the mikrotik specific scripting language

Sun Apr 02, 2023 12:23 pm

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?
 
DarkNate
Forum Guru
Forum Guru
Posts: 1015
Joined: Fri Jun 26, 2020 4:37 pm

Re: Reasons to hold on to the mikrotik specific scripting language

Sun Apr 02, 2023 12:25 pm

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.
 
mischa01101
just joined
Topic Author
Posts: 8
Joined: Wed Feb 08, 2023 12:31 pm

Re: Reasons to hold on to the mikrotik specific scripting language

Sun Apr 02, 2023 12:34 pm

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/
 
zainarbani
Frequent Visitor
Frequent Visitor
Posts: 54
Joined: Thu Jul 22, 2021 9:42 am
Location: Pati, Indonesia

Re: Reasons to hold on to the mikrotik specific scripting language

Sun Apr 02, 2023 3:29 pm

Make Busybox accessible
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3423
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: Reasons to hold on to the mikrotik specific scripting language

Sun Apr 02, 2023 6:05 pm

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.
 
usern
just joined
Posts: 7
Joined: Sat May 30, 2020 2:37 am

Re: Reasons to hold on to the mikrotik specific scripting language

Mon Apr 03, 2023 3:19 pm

Proper support for functions would be greatly appreciated. I could not get the current "variable calling" to work with nested "function calls".
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12001
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Reasons to hold on to the mikrotik specific scripting language

Mon Apr 03, 2023 4:18 pm

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.

Who is online

Users browsing this forum: No registered users and 28 guests