dividuum / info-beamer

The Multimedia Presenter for Lua (for commercial projects, use info-beamer pi instead)
https://info-beamer.com/
Other
227 stars 48 forks source link

Allow os Lib functions for Date and Time operations #33

Closed elberfeld closed 8 years ago

elberfeld commented 8 years ago

Allow some more functions from Lua's os Lib inside the sandbox. These functions are needed for date/time operations.

dividuum commented 8 years ago

The patch is fine, but I won't merge it, as not exposing these functions is a deliberate design decision. You can read about it here: https://info-beamer.com/doc/info-beamer#howdoigetthecurrenttime

That said - The PI version exposes os.time and os.date and both the pi and the open source versions have a way the read specially formatted environment variables (INFOBEAMERENV can be read using sys.get_env "name"). But using any of those is usually a sign that you are doing something wrong and they trigger a warning on the pi version.

The better way to handle time is probably to use an external program to do proper time calculations and then use the really simple UDP interface to interact with info-beamer. Instead of using environment variables, it's usually better to just use json config files instead. Changing options at runtime is easily doable that way. You can't do that with environment variables without restarting info-beamer.