dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re: Proposed Function Additions to Plugins

Re: Proposed Function Additions to Plugins

From: Amaury Pouly via rockbox-dev <>
Date: Thu, 24 Aug 2017 20:26:13 +0200

> As for the api version variable in lua I noticed writing a few scripts
> that there is no versioning so you have to check everything against nil
> before you use it although that is good practice I think it'd be nice to
> know immediately that a function is not available although it's probably
> just as much work to check the version anyways

You are correct that there is no versioning in lua. However the version is
very C specific because it relies on:
1) the C code to embed the *compile time version*
2) the loader to compare that version against its *own version* at *runtime*
In other words, the only sane way to handle this in lua would be to
automatically add the C version of the ABI to the lua file.
Thus it seems to me that the second best method is indeed to check whether
some method is nil or not (probably by testing the function that requires
the highest version of the API). It's error prone but less that the version
I believe.
Received on 2017-08-24

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy