Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llEval(string code);

Alpha Zaius
llLol()
Join date: 13 Mar 2004
Posts: 1,187
08-04-2004 16:51
In php, the function eval() can execute a piece of code from a string.

I would LOVE to have llEval(string code[,list denied_functions]);

list denied functions could be a list like:
[llSetObjectName(),llDie()] etc etc

It would be nice to have an object look in a database of scripts and be able to select the script it would do...
like a weapon can xml-rpc a website (maybe soon?) and get the code.. if the code has changed, it will overwrite the current code with the code. :) Idea (c) 2004-2005 Alpha Zaius
_____________________
Malachi Petunia
Gentle Miscreant
Join date: 21 Sep 2003
Posts: 3,414
08-04-2004 18:14
I highly doubt that you will ever see "eval" implemented in LSL. PHP was originally based on Perl which had intrinsic support for eval(). LSL is given a small fraction of the sim's CPU and compilation into bytecode is probably an extremely expensive operation. So, even if it were relatively easy to implement, you could expect the performance to be so poor as to be unusable for most purposes.

Yes, most of that is an informed guess. Refutation is welcome.
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
10-18-2004 02:50
Eh, I thought the compiler worked on the client and then uploaded the bytecode. So it really makes eval() impossible, doesnt it.
Damn. I was going to suggest it until I found this thread.
CAN WE PLEASE MOVE TO PYTHON OR SOMETHING KTHXBYE
Huns Valen
Don't PM me here.
Join date: 3 May 2003
Posts: 2,749
10-19-2004 17:07
From: Eggy Lippmann
Eh, I thought the compiler worked on the client and then uploaded the bytecode.
I think that is exactly how it works. eval() would be way cool but kinda tough to implement, not to mention expensive.
Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
10-19-2004 17:49
From: Eggy Lippmann
CAN WE PLEASE MOVE TO PYTHON OR SOMETHING KTHXBYE


Oh, yes, because I really need to learn another language!
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
10-20-2004 23:44
LOL, you suck. Who the hell doesnt know Python these days? Are you working for MS? :)
Dude, you can "learn" Python in 30 minutes. It is that easy.
Syntax is mostly C-ish, but you use tabs instead of curly brackets.
Imagine being able to do this in LSL:
CODE

for curString in gList:
llSay(0, curString[2..4]);

This prints characters 2 to 4 in ALL strings in the WHOLE list!
You can do stuff like a, b, c = 1, 1, a+b and it will do the same as a=1; b=1;c=a+b;
Don't even get me started on tuples. Or comprehension lists.
Once you've gone Python you'll never go back! Python is the reason why I started hating C.
Plus, Don said that LSL would continue to be supported if we did move to Python.
So you dont have to learn anything.
Piprrr Godel
Code Wrangler
Join date: 25 Sep 2003
Posts: 54
10-21-2004 15:11
From: Eggy Lippmann
LOL, you suck. Who the hell doesnt know Python these days? Are you working for MS? :)
Dude, you can "learn" Python in 30 minutes. It is that easy..

I agree with Eggy -- Python is very easy to learn.

I would love an SL python API.
_____________________
I'm taking reality in small doses to build immunity.