[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Named metatables (type-named data), similar to typedef of structs in C
- From: bil til <flyer31@...>
- Date: Fri, 25 Oct 2019 02:29:59 -0700 (MST)
Thank you... so this was silly question, I hope I understand now ...
So if my transmitter wants to pack with timetype info, this is straight
forward, as timetype is linked to starttime and endtime, and transmitter
pack function gets the starttime and endtime.
And if the receiver lua device wants to unpack and has "timetype" string
info in the formatstring somehow, the receiver can create the corresponding
table quite easily like this (timetype needs to be globally defined then,
but this is anyway clear in my application):
strTypeInfo= "timetype"
...the receiver extracts this somehow from the format string, and then
somehow gets these two tables starttime, endtime, and then it can use the
following to connect starttime, endtime to the timetype timeinfo:
lua_getglobal( strTypeInfo)
lua_setmetatable( ...)
... very neat .. I hope I REALLY got this and did not overlook anything...
--
Sent from: http://lua.2524044.n2.nabble.com/Lua-l-f2524044.html