ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Lua userdata
@ 2026-02-12 15:58 Henning Hraban Ramm
  2026-02-12 16:32 ` [NTG-context] " Hans Hagen via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: Henning Hraban Ramm @ 2026-02-12 15:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

I got used to declare

userdata = userdata or {}

at the begin of my Lua code, and use userdata.* for “public” variables 
and functions, but I recognized that userdata is actually a Lua 
datatype, so that might have been a misunderstanding.

Should I/we use userdata, thirddata or a different namespace convention?

Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [NTG-context] Re: Lua userdata
  2026-02-12 15:58 [NTG-context] Lua userdata Henning Hraban Ramm
@ 2026-02-12 16:32 ` Hans Hagen via ntg-context
  2026-02-12 17:40   ` Henning Hraban Ramm
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen via ntg-context @ 2026-02-12 16:32 UTC (permalink / raw)
  To: ntg-context; +Cc: Hans Hagen

On 2/12/2026 4:58 PM, Henning Hraban Ramm wrote:
> Hi,
> 
> I got used to declare
> 
> userdata = userdata or {}
> 
> at the begin of my Lua code, and use userdata.* for “public” variables 
> and functions, but I recognized that userdata is actually a Lua 
> datatype, so that might have been a misunderstanding.
> 
> Should I/we use userdata, thirddata or a different namespace convention?

moduledata is for modules (like m-*), thirddata is for third party 
modules (like t-*) and userdata for users (like hraban)

all other global assignments will trigger a warning (so if you get one 
that looks suspicious i.e. is my problem you can tell me)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [NTG-context] Re: Lua userdata
  2026-02-12 16:32 ` [NTG-context] " Hans Hagen via ntg-context
@ 2026-02-12 17:40   ` Henning Hraban Ramm
  0 siblings, 0 replies; 3+ messages in thread
From: Henning Hraban Ramm @ 2026-02-12 17:40 UTC (permalink / raw)
  To: ntg-context

Am 12.02.26 um 17:32 schrieb Hans Hagen via ntg-context:
> On 2/12/2026 4:58 PM, Henning Hraban Ramm wrote:
>> I got used to declare
>>
>> userdata = userdata or {}
>>
>> at the begin of my Lua code, and use userdata.* for “public” variables 
>> and functions, but I recognized that userdata is actually a Lua 
>> datatype, so that might have been a misunderstanding.
>>
>> Should I/we use userdata, thirddata or a different namespace convention?
> 
> moduledata is for modules (like m-*), thirddata is for third party 
> modules (like t-*) and userdata for users (like hraban)
> 
> all other global assignments will trigger a warning (so if you get one 
> that looks suspicious i.e. is my problem you can tell me)

Thanks for clarification.

Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-12 17:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-12 15:58 [NTG-context] Lua userdata Henning Hraban Ramm
2026-02-12 16:32 ` [NTG-context] " Hans Hagen via ntg-context
2026-02-12 17:40   ` Henning Hraban Ramm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).