Best way for writing a dynamic function

i wrote a app that need run dynamic function by other service or admin (sometimes)

my logic for this :

in loop fetching line-by-line from file
and that transform it
and it write to new file.

  1. use lua ( i just heard about it)
  2. i will write a simple internal compiler/parsing
  3. simple way ( every time i need to this transform , i run a app in our cluster and that connect to service and fetching all and transform and send it )

maybe a better way ??

In many cases, you won't be able to trust the dynamic code. In that case, sandboxing is needed.

Lua is a good way to do it, but there are some caveats. I recently inquired on this forum if someone has experiences with Lua and Rust, then decided to work on my own sandboxing system (but there are already some existing libraries, see linked post).

Depending on what you want to execute, you might want a touring complete language, or a less powerful language. And you might want to think about limiting the resources used by the executed code (e.g. memory or CPU use, or total execution time).

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.