Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
jthomas
Newbie


Joined: 23 Oct 2016
Posts: 5

PostPosted: Thu Jun 14, 2018 1:33 am   

Using lua to access variables by class
 
I have two classes, ClassOne and ClassTwo, both contain variables with the same name, thisvariable.


Using lua, how do I use the zs.var to access a specific variable?


zs.var.thisvariable only gives me the last variable created (highest ID i'm assuming)


i see zs.makevar lets me specify a class to create in, how do i reverse that for finding a variable in a specific class?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4692
Location: Pensacola, FL, USA

PostPosted: Thu Jun 14, 2018 1:33 pm   
 
Supposedly the getvar function can do this, but even specifying the class data is not pulling the variable from the specified class, still only hitting the one last created.

#LUA {a=zs.getvar("thisvariable", "ClassOne");print(a.value)}

As such, this may not be currently possible with Lua.
_________________
Discord: Shalimarwildcat
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net