<div dir="ltr"><div>I understand that, but knowing the name allows you to write a function that gives you what you want.</div><div><br></div><div>Jussi<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 7, 2023 at 1:15 AM vuott--- via User <<a href="mailto:user@lists.gambas-basic.org">user@lists.gambas-basic.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div>Hi Jussi,<br></div><div dir="auto">it seems to me that Brian G was <u>not</u> interested in knowing the <u>name</u> (label) of the Structure, but that the instance of the Structure was a "<u>Structure</u>" Object .<br></div><div><br></div><div><br></div><div dir="auto"><br></div><div>6 apr 2023, 23:39 da <a href="mailto:jussi.lahtinen@gmail.com" target="_blank">jussi.lahtinen@gmail.com</a>:<br></div><blockquote style="border-left:1px solid rgb(147,163,184);padding-left:10px;margin-left:5px"><div dir="ltr"><div>But if TypeOf() tells it is an object, then can't you get the structure name with Object.Type()?<br></div><div><br></div><div>Jussi<br></div><div><br></div><div><div><div dir="ltr">On Thu, Apr 6, 2023 at 9:33 AM Brian G <<a href="mailto:brian@westwoodsvcs.com" rel="noopener noreferrer" target="_blank">brian@westwoodsvcs.com</a>> wrote:<br></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><p dir="ltr" style="margin-top:0px">Yes but this does not differentiate a structure from a normal object<br></p><div id="m_-1960183414913287155m_-170710087095817763mail-app-auto-default-signature"><p dir="ltr"></p><div>--<br></div><div> Thanks<br></div><div> Brian G<br></div><p></p></div><div>Wednesday, 05 April 2023, 02:22PM -07:00 from Jussi Lahtinen <a href="mailto:jussi.lahtinen@gmail.com" rel="noopener noreferrer" target="_blank">jussi.lahtinen@gmail.com</a>:<br></div><div><br></div><blockquote style="border-left:1px solid rgb(8,120,189);margin:0px 0px 0px 10px;padding:0px 0px 0px 10px" cite="http://16807297370000065044" id="m_-1960183414913287155m_-170710087095817763mail-app-auto-quote"><div><div><div id="m_-1960183414913287155m_-170710087095817763style_16807297370000065044_BODY"><div><div dir="ltr"><div>There is already TypeOf() function. And you can get the class with Object.Type().<br></div><div><br></div><div>Jussi<br></div></div><div><br></div><div><div><div dir="ltr">On Wed, Apr 5, 2023 at 7:05PM vuott--- via User <<a rel="noopener noreferrer" href="mailto:user@lists.gambas-basic.org" target="_blank">user@lists.gambas-basic.org</a>> wrote:<br></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div dir="auto">On this thread<br></div><div dir="auto">  <a rel="noopener noreferrer" href="https://lists.gambas-basic.org/pipermail/user/2023-March/078862.html" target="_blank">https://lists.gambas-basic.org/pipermail/user/2023-March/078862.html</a><br></div><div dir="auto">Brian G asked, if it were possible to know if an Object is a Structure.<br></div><div dir="auto">In Gambas source file<br></div><div dir="auto">  /home/[USER]/gambasdevel/main/share/gambas.h<br></div><div dir="auto">the numbers of datatypes identifiers are listed.<br></div><div dir="auto">Therefore, by knowing which number a declared variable belongs to, it is possible to know its data type.<br></div><div dir="auto">I found a way to know, from the memory address of the variable it is necessary to go back 8 units. Deferencing the Pointer will give the identifier number of the data type of the variable, which consequently will have to be compared with the list above.<br></div><div dir="auto"><br></div><div dir="auto">This is my simply code:<br></div><div dir="auto"><br></div><div dir="auto">[code]<br></div><div dir="auto">Public Struct Struttura<br></div><div dir="auto"> b As Byte<br></div><div dir="auto"> c As Short<br></div><div dir="auto">End Struct<br></div><div dir="auto"><br></div><div dir="auto">Private id As Struct Struttura<br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">Public Sub Main()<br></div><div dir="auto"><br></div><div dir="auto">Dim p As Pointer<br></div><div dir="auto"><br></div><div dir="auto">p = VarPtr(id)<br></div><div dir="auto"><br></div><div dir="auto">Print "Gambas datatype identifier: "; Byte@(p - 8)<br></div><div dir="auto"><br></div><div dir="auto">End<br></div><div dir="auto">[/code]<br></div><div dir="auto"><br></div><div dir="auto">It should be noted that in the list of data-type identifier numbers, in particular, the data type Structure is NOT present.<br></div><div dir="auto">It will be located and reported by my code as an "Object" (number: 16)<br></div></div><div><br></div><div>----[ <a rel="noopener noreferrer" href="http://gambaswiki.org/wiki/doc/netiquette" target="_blank">http://gambaswiki.org/wiki/doc/netiquette</a> ]----<br></div></blockquote></div></div></div></div><div><div><br></div><div>----[ <a href="http://gambaswiki.org/wiki/doc/netiquette" rel="noopener noreferrer" target="_blank">http://gambaswiki.org/wiki/doc/netiquette</a> ]----<br></div></div></div></div></blockquote></div><div><br></div><div>----[ <a rel="noopener noreferrer" href="http://gambaswiki.org/wiki/doc/netiquette" target="_blank">http://gambaswiki.org/wiki/doc/netiquette</a> ]----<br></div></blockquote></div></div></div></blockquote><div dir="auto"><br></div> </div>
<br>
----[ <a href="http://gambaswiki.org/wiki/doc/netiquette" rel="noreferrer" target="_blank">http://gambaswiki.org/wiki/doc/netiquette</a> ]----<br>
</blockquote></div>