[24 Feb 2008] _G Global variables reading/creating

Contains all messages from the Hollywood mailing list between 01/2006 and 08/2012
Locked
Dwayne

[24 Feb 2008] _G Global variables reading/creating

Post by Dwayne »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Sun, 24 Feb 2008 14:03:36 +1100

Andreas,

I have been unable to utilise the _G table to check global variables. Do you have the mechanism to read and create global Variables using a table within your implementation of LUA. The reason I ask is that I have found some code on the LUA website that I am converting which allows for the easy creation and manipulation of classes including inheritance. I am at a stage where I have found that this is stopping my testing.

Regards,

Dwayne
Dwayne

[24 Feb 2008] RE: _G Global variables reading/creating

Post by Dwayne »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Sun, 24 Feb 2008 19:24:47 +1100

Andreas,

I should have mentioned that purpose behind this is to create Global Variables dynamically by accessing the _G variable table direct.

for instance.

Code: Select all

name="Account"
_G[name]={}
would create the Global Variable Account. If there is another way of achieving this I am open to that as well and consequently would post the classes example for everybody to utilise if they choose.

Regards,

Dwayne
User avatar
airsoftsoftwair
Posts: 5834
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[24 Feb 2008] Re: _G Global variables reading/creating

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Sun, 24 Feb 2008 21:07:09 +0100
Andreas,

I have been unable to utilise the _G table to check global variables. Do you have the mechanism to read and create global Variables using a table within your implementation of LUA. The reason I ask is that I have found some code on the LUA website that I am converting which allows for the easy creation and manipulation of classes including inheritance. I am at a stage where I have found that this is stopping my testing.
Sorry, due to a bug, the _G table is currently not accessible in Hollywood so thanks for pointing this out. I'll definitely fix this in the next update because the _G table is a really useful thing.

(NB: Actually it is there but you will never be able to access it because Hollywood internally handles every variable name in lower case notation. This is how case insensitivity is implemented in Hollywood. So Hollywood will always be looking for a table named "_g" which is not there. I need to add a special check in my lower case conversion function which checks if the name is "_G" and then does not convert to lower case.)

Thanks for the bug report.
Dwayne

[25 Feb 2008] RE: _G Global variables reading/creating

Post by Dwayne »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Mon, 25 Feb 2008 20:25:39 +1100

Cool.

Looking forward to it.
Locked