Top Mud Sites Forum Return to TopMudSites.com
Go Back   Top Mud Sites Forum > Mud Development and Administration > MUD Coding
Click here to Register

Reply
 
Thread Tools
Old 07-17-2003, 06:59 AM   #1
Tamsyn@zebedee.org
New Member
 
Join Date: Mar 2003
Posts: 23
Tamsyn@zebedee.org is on a distinguished road
OK, for you advanced LPC coders:
If I have a global string variable, say 't' in an object, I can
reference it's value within a closure:

f = lambda( ({}), ({#'write,({#'t}) }) );
funcall(t);

This will do write(t);
My question: Is it possible to dynamically specify/bind the name of the variable. I've tried various ways of using symbol_function() and quote() with no success, and my gut feeling is that it isn't possible.
Anyone have the definitive answer?
Tamsyn@zebedee.org is offline   Reply With Quote
Old 07-17-2003, 08:29 AM   #2
markizs
Member
 
Join Date: Jan 2003
Location: Riga, Latvia
Posts: 36
markizs is on a distinguished road
Send a message via ICQ to markizs
cool. first decent LPC question i see in topmudsties
shame that i even couldnt understand fully question and no way can answer it.

just were wondering if you didnt mean

funcall(f);

instead of

funcall(t);
markizs is offline   Reply With Quote
Old 07-17-2003, 08:31 AM   #3
Tamsyn@zebedee.org
New Member
 
Join Date: Mar 2003
Posts: 23
Tamsyn@zebedee.org is on a distinguished road
yes i did, thanks for pointing that out.
Tamsyn@zebedee.org is offline   Reply With Quote
Old 07-17-2003, 08:02 PM   #4
JilesDM
Member
 
Join Date: Nov 2002
Posts: 66
JilesDM is on a distinguished road
If you want to bind to an arbitrary global variable in the same object as the closure is being constructed in, it's simple:
[code] string x;
closure f;

x = whatever_variable_name;
f = lambda(({}),({#'write,({#'apply,symbol_variable(x) })}));
[/quote]

The key here is remembering to run the symbol returned by symbol_variable through apply or funcall.
JilesDM is offline   Reply With Quote
Old 07-21-2003, 05:41 AM   #5
Tamsyn@zebedee.org
New Member
 
Join Date: Mar 2003
Posts: 23
Tamsyn@zebedee.org is on a distinguished road
Yep, thanks for that.
Basically my problem boils down to: Our driver is too old, it doesn't have symbol_variable().
No wonder I couldn't get it to work eh
Tamsyn@zebedee.org is offline   Reply With Quote
Reply


Thread Tools


Advanced LPC question - Similar Threads
Thread Thread Starter Forum Replies Last Post
Advanced Building - Area Development Rundvelt MUD Builders and Areas 20 09-16-2004 08:18 PM
Advanced Plot Development Course Brody MUD Announcements 0 11-14-2003 12:51 PM
Advanced Stat Systems Eagleon Advanced MUD Concepts 5 06-28-2003 07:26 PM
Advanced LPC snowfruit MUD Coding 4 11-08-2002 11:12 AM
expanded advanced mud search Burr Bugs and Suggestions 0 05-24-2002 09:44 PM

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -4. The time now is 11:22 AM.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Style based on a design by Essilor
Copyright Top Mud Sites.com 2014