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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Valkenar
Beginner


Joined: 12 Aug 2009
Posts: 15

PostPosted: Fri Jun 18, 2010 11:12 pm   

[3.20] Variables in class with lua
 
My expectation is that if I have a class with the "set as default when executing" box checked, then variables created by aliases in that class should also be inside that class. If that's not true then the rest of this is irrelevant.

Given a class with an alias in that uses the zs.var object to create a variable, like so
Code:
<class name="Aliastest" setdefault="true" id="30">
  <alias name="CreateVariable" language="Lua" id="31">
    <value>print("Creating variable")
zs.var.mytestvar = "It exists"</value>
  </alias>
</class>


If you execute this alias, the variable is created in the package root, rather then inside the "Aliastest" class. Is this expected behavior, or a bug?

If it's expected behavior, what's the recommended method for creating variables inside specific classes? Ideally an answer in lua code would be best, but an answer in zscript would be welcome also. Is it necessary to use makevar for this?

If the answer is makevar, then how do you get to a variable that is two classes deep?
Thanks, and nice work getting 3.20 out.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sat Jun 19, 2010 12:47 am   
 
Using zs.cmd.var(arguments) the same way you would use #VAR whatever options.

It doesn't create variables in the class the alias is in unless specifically specified.

Charneus
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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