Access to sw-description fields

16 views
Skip to first unread message

Piotr Piwko

unread,
Nov 17, 2025, 7:15:40 AMNov 17
to swupdate
Hi, 

I have a simple sw-description file like this:

software = 
{
    version = "1.0.0"
    embedded-script = "
        swupdate.warn(\"new version: \" .. version)
    "
    ...
}

I would like to access the version field inside the Lua script, but all my attempts have failed. Could someone point me to documentation or an example that describes how to do this?

Thank you in advance,


Thank you in advance, 

-- 
Piotr Piwko

Stefano Babic

unread,
Nov 17, 2025, 7:25:10 AMNov 17
to swup...@googlegroups.com
Hi Piotr,

On 11/17/25 13:11, Piotr Piwko wrote:
> Hi,
>
> I have a simple sw-description file like this:
>
> software =
> {
>     version = "1.0.0"
>     embedded-script = "
>         swupdate.warn(\"new version: \" .. version)
>     "
>     ...
> }
>
> I would like to access the version field inside the Lua script, but all
> my attempts have failed. Could someone point me to documentation or an
> example that describes how to do this?

Version is exposed by SWUpdate:

embedded-script = "
require('swupdate')
swupdate.warn(\"new version: \" .. swupdate.getversion)
"

Best regards,
Stefano Babic

Piotr Piwko

unread,
Nov 17, 2025, 9:29:44 AMNov 17
to Stefano Babic, swup...@googlegroups.com
It returns the swupdate's version (2024.0), not the content of the `version` field in sw-description (in my example 1.0.0).
 
       "

Best regards,
Stefano Babic

--
You received this message because you are subscribed to the Google Groups "swupdate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swupdate+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/swupdate/21d8c957-094d-4f3f-a181-4f25e2d70dcc%40swupdate.org.


--

Stefano Babic

unread,
Nov 17, 2025, 10:13:04 AMNov 17
to Piotr Piwko, swup...@googlegroups.com
Hi Piotr,

On 11/17/25 15:29, Piotr Piwko wrote:
> pon., 17 lis 2025 o 13:25 Stefano Babic <stefan...@swupdate.org
> <mailto:stefan...@swupdate.org>> napisał(a):
>
> Hi Piotr,
>
> On 11/17/25 13:11, Piotr Piwko wrote:
> > Hi,
> >
> > I have a simple sw-description file like this:
> >
> > software =
> > {
> >      version = "1.0.0"
> >      embedded-script = "
> >          swupdate.warn(\"new version: \" .. version)
> >      "
> >      ...
> > }
> >
> > I would like to access the version field inside the Lua script,
> but all
> > my attempts have failed. Could someone point me to documentation
> or an
> > example that describes how to do this?
>
> Version is exposed by SWUpdate:
>
>        embedded-script = "
>            require('swupdate')
>            swupdate.warn(\"new version: \" .. swupdate.getversion)
>
>
> It returns the swupdate's version (2024.0), not the content of the
> `version` field in sw-description (in my example 1.0.0).

Yes, you're right, I misunderstood.

There is currently no access to global attributes (like "version"). It
is not a big deal to add it, but it is currently unsupported. Versions
are likely managed by the core, and there wasn't yet a use case to add
an interface here.

Best regards,
Stefano Babic

>
> --
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to swupdate+u...@googlegroups.com
> <mailto:swupdate%2Bunsu...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/
> swupdate/21d8c957-094d-4f3f-a181-4f25e2d70dcc%40swupdate.org
> <https://groups.google.com/d/msgid/swupdate/21d8c957-094d-4f3f-
> a181-4f25e2d70dcc%40swupdate.org>.
>
>
>
> --
> Piotr Piwko
> https://www.piotrpiwko.com/ <https://www.piotrpiwko.com/>
>
> --
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+u...@googlegroups.com
> <mailto:swupdate+u...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/
> swupdate/CAMTWR-PHv-
> aRP%2BDfnWSZbKwZ0VKJNP6W6jhpusC%3DkvsXfhJUpw%40mail.gmail.com <https://
> groups.google.com/d/msgid/swupdate/CAMTWR-PHv-
> aRP%2BDfnWSZbKwZ0VKJNP6W6jhpusC%3DkvsXfhJUpw%40mail.gmail.com?
> utm_medium=email&utm_source=footer>.

Reply all
Reply to author
Forward
0 new messages