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, 05: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, 07: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
markizs is offline   Reply With Quote
Old 07-17-2003, 07: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, 07: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, 04:41 AM   #5
Tamsyn@zebedee.org
New Member
 
Join Date: Mar 2003
Posts: 23
Tamsyn@zebedee.org is on a distinguished road
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 07:18 PM
Advanced Plot Development Course Brody MUD Announcements 0 11-14-2003 11:51 AM
Advanced Stat Systems Eagleon Advanced MUD Concepts 5 06-28-2003 06:26 PM
Advanced LPC snowfruit MUD Coding 4 11-08-2002 10:12 AM
expanded advanced mud search Burr Bugs and Suggestions 0 05-24-2002 08: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 07:16 AM.


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