Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

LSL v LUA

Rock Vacirca
riches to rags
Join date: 18 Oct 2006
Posts: 1,093
04-22-2009 01:31
Hi,

I would like to have the opinion of LSL scripters who have also used LUA. A new Virtual World, Blue Mars, will use LUA, and I was wondering what the advantages/disadvantages were over LSL.

Rock
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
04-22-2009 01:41
The language is not so much the issue as the API and the limitations you have to work within in terms of memory and such.

As long as you have the important elements in place, and LUA does, it is all down to the interface.
Rock Vacirca
riches to rags
Join date: 18 Oct 2006
Posts: 1,093
04-22-2009 02:02
From: Talarus Luan
The language is not so much the issue as the API and the limitations you have to work within in terms of memory and such.

As long as you have the important elements in place, and LUA does, it is all down to the interface.


Thanks for the reply. I have never used LUA so I have no idea what it is capable of. I have used LSL, and I am well aware of its limitations, which have been discussed at length in this forum, and I was mainly wondering if any of the main problems areas with LSL (writing to notecards, script memory allocation, data storage issues, 'missing' commands, etc) are solved by LUA.

Rock
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-22-2009 03:21
it's really a matter of implementation... without seeing what's they've made available and what they haven't, it's anyone guess what issues it will and won't have.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
04-22-2009 04:06
From: Void Singer
it's really a matter of implementation... without seeing what's they've made available and what they haven't, it's anyone guess what issues it will and won't have.

Correct.

Rock, lua has the missing commands. Everything else you asked about thou; These are not restricted in LSL, only in the environment.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
04-22-2009 06:27
From: Jesse Barnett
Rock, lua has the missing commands.
I'm not sure I'd go that far, even. I don't have any LUA experience, but just glancing through the language reference, I can't find even a "case" construct. (On the other hand it appears that closures are built in, and what seem to be function pointers, so perhaps one could implement the moral equivalent of a calculated jump?)

I'm pretty fuzzy on how one grafts a language like this into an event-based execution environment, but then I also don't know how that's being done for the current prototype C# Mono binding (https://wiki.secondlife.com/wiki/User:Babbage_Linden/Office_Hours/2009_04_22#chat57).
_____________________
Archived for Your Protection
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
04-22-2009 06:30
One could try the Metaplace beta if they wanted a sample of Lua programming in an active available virtual world.
_____________________
-

So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.

I can be found on the web by searching for "SuezanneC Baskerville", or go to

http://www.google.com/profiles/suezanne

-

http://lindenlab.tribe.net/ created on 11/19/03.

Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard,
Robin, and Ryan

-
Rock Vacirca
riches to rags
Join date: 18 Oct 2006
Posts: 1,093
04-22-2009 06:48
From: SuezanneC Baskerville
One could try the Metaplace beta if they wanted a sample of Lua programming in an active available virtual world.


Thanks for that SuezanneC. I visited Metaplace, then left as it wasn't my cup of tea, just long enough to write a brief report. I did not note the scripting language, and I must make a point of noting that on my travels from now on.

I was rather hoping that someone in the LSL Scripting Tips forum had already some experience of Lua, from WoW perhaps, and could give me an opinion on whether choosing Lua was a smart move by BM, or whether they think that LSL is superior in some way.

Rock
Dain Shan
Registered User
Join date: 28 Mar 2008
Posts: 32
04-22-2009 07:34
From: Rock Vacirca
Thanks for that SuezanneC. I visited Metaplace, then left as it wasn't my cup of tea, just long enough to write a brief report. I did not note the scripting language, and I must make a point of noting that on my travels from now on.

I was rather hoping that someone in the LSL Scripting Tips forum had already some experience of Lua, from WoW perhaps, and could give me an opinion on whether choosing Lua was a smart move by BM, or whether they think that LSL is superior in some way.

Rock


I have some minor experience with the LUA of wow. From wayyyyy back when the beta was running and a couple month after.

Well in regard of that game, you could rebuild the entire UI from scratch with this. Graphics, Layout and also programm the functions into the buttons.

It works in a very similar way i think.
Short example (right out of my mind .. so dont call me on it)

if TestVar == "TestText1" then

ChatFrame1:AddMessage("TestText1";) --prints "TestText1" into ChatFrame1 (Chatwindow)
elseif TestVar == "TestText2" then

ChatFrame1:AddMessage("TestText2";) --Prints "TestText2 into ChatFrame1

else

ChatFrame1:AddMessage("neighter TestText1 or TestTex2";)

--prints "neighter TestText1 or TestTex2" into ChatFrame1

end


Very simple commands who are mostly self explanatory.
The usual boolean operators are aviable.

Another one is the creation of frames.
This is an example of a normal free moveable frame in this game

local MyAddonFrame = CreateFrame("Frame", "MyAddonFrame", UIParent)
MyAddonFrame:EnableMouse(true)
MyAddonFrame:SetMovable(true)
MyAddonFrame:SetUserPlaced(true)
MyAddonFrame:RegisterForDrag("LeftButton";)
MyAddonFrame:SetScript("OnDragStart", function() this:StartMoving() end)
MyAddonFrame:SetScript("OnDragStop", function() this:StopMovingOrSizing() end)
MyAddonFrame:SetWidth(300)
MyAddonFrame:SetHeight(300)
MyAddonFrame:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
edgeSize= 16, insets = { left = 0, right = 0, top = 0, bottom = 0 }})
MyAddonFrame:SetBackdropColor(0.0,0.0,0.0,0.9)
MyAddonFrame:ClearAllPoints()
MyAddonFrame:SetPoint("CENTER", UIParent)

Crates a fully moveable frame, variable (dragable) size, with a defined backgroundcolor, a defined backgroungpicture in the center of the screen.
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
04-22-2009 08:16
From: Talarus Luan
The language is not so much the issue as the API and the limitations you have to work within in terms of memory and such.

As long as you have the important elements in place, and LUA does, it is all down to the interface.


Lua has some language constructs built-in that make it far better than LSL, in my opinion. LSL is purely procedural, while LUA allows for objects, associative arrays, inheritence, closures, function pointers, and on and on.

There is no question in my mind that LUA is a far more productive language to work with. While in either case the power of the language to control the virtual world is limited to the exposed API, there are clear advantages to LUA.

I'm frankly quite surprised that LL decided to roll their own scripting language in the first place. Implementing LUA and exposing the engine's internals to the LUA runtime is so well-documented and easy to do that I can only think it must have been a severe case of NIH (Not Invented Here) syndrome that prompted such a poor decision.


.
_____________________
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
04-22-2009 08:57
My main concern about existing languages like Lua is that the runtime environments for these languages assume a relatively small number of parallel instances, and are not well suited to frequent rapid snapshots.

* It's rare to have more than a few hundred active scripts running on a single system, let alone several thousand as is typical in SL. To get good and predictable performance from a runtime takes a LOT of work. Mono still has scheduling problems after two years of development and integration with Second Life.

* Snapshotting a running Mono script and starting one up is a lot more complex and time-consuming than doing the same thing for an LSL2 script, and region crossing with running Mono scripts is still more of a problem than with LSL2. Doing the same thing for a new runtime will require an effort of the same magnitude as the Mono port.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
04-22-2009 10:04
I have the feeling that a lot of the Mono problems come from trying to tie it into a long-established environment that started out with such a crumbly and ill thought-out scripting language and VM AND TRYING TO MAKE IT WORK EXACTLY LIKE THAT EXISTING ENVIRONMENT. I'd bet you anything that if SL had started out with a different scripting/programming system (Mono, Perl, Lua, Python, Java, whatever) things would be a lot different and a GREAT deal smoother today. There's a great deal to be said for taking advantage of a well-used platform that is constantly being contributed to by sources outside your own small company. And if you think none of those are used in contexts that rival the challenges of the SL environment, I beg to differ. There are plenty of enterprise systems with a HELL of a lot of concurrency that use some of those. Platform developers for many of them have to think a great deal about system security and performance, and the engines usually have a great deal of tuning, optimization, and security policies that can be tweaked for this sort of environment.

But anyway, history is history. It is unfortunate that we have to live with SL's poor history right now, but it is often our own fault for insisting that everything be absolutely, 100% backwards and forwards compatible. Poor LL. These new virtual worlds have a huge technological advantage in choosing languages/VMs in a more open and forward-thinking fashion than LL did 7 years ago (or whatever). Good for them! It'll be interesting to see how many of them overcome the business challenges as well as the technological ones. There's the key to SL's success IMO, not the bass-ackwards scripting language/engine.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
04-22-2009 10:09
From: Hewee Zetkin
I'd bet you anything that if SL had started out with a different scripting/programming system (Mono, Perl, Lua, Python, Java, whatever) things would be a lot different and a GREAT deal smoother today.
Well, I've spent a lot of time over the past quarter of a century hooking virtual machines (interpreters, runtimes, whatever you call them) into real-time control systems, and I haven't found a single VM that can be depended on for hard real-time response under concurrent load, other than things like Forth systems that were written for real-time work from the ground up.
From: someone
There are plenty of enterprise systems with a HELL of a lot of concurrency that use some of those.
They're not providing real-time response.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
04-22-2009 14:20
<3 Forth. :)
_____________________
-

So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.

I can be found on the web by searching for "SuezanneC Baskerville", or go to

http://www.google.com/profiles/suezanne

-

http://lindenlab.tribe.net/ created on 11/19/03.

Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard,
Robin, and Ryan

-
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
04-22-2009 14:45
From: SuezanneC Baskerville
<3 Forth. :)
We had a 3 user PolyForth development system with 12K of ROM and 4K of RAM. Before anyone could test anything they had to call out "testing" so everyone in the editor could save their buffers and drop back to "ok" in case they crashed the system.

LSL2 gives you a whole 16K of RAM all to yourself! LUXURY!
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Boreal Latte
Registered User
Join date: 15 Nov 2007
Posts: 104
04-22-2009 22:33
Remembers her Jupiter Ace <3 ..... And a wonderfull Forth on the Amiga 500.

I never looked at LUA - but if they actually have continuations, the event based programming of LSL could have been much nicer encapsulated.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-22-2009 23:44
considering the length of time for development for LSL and the the length of time it would have taken to implememnt lua, I imagine the conversation went like this...

Linden A:so I thinkwe should use lua for scripting, but it's going to take a little bit to implement.
Linden B: nah I can write ya a scripting language by the end of this weekend...
(historical joke)
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
04-23-2009 03:56
From: Void Singer
considering the length of time for development for LSL and the the length of time it would have taken to implememnt lua
I've made this same decision a dozen times, and gone both ways... and given the constraints on scripting in SL... it would have taken as long to get Lua or any other "high function" scripting language working as it took to get Mono working, and it's still screwing up scheduling after two years. An LSL script has to run indefinitely with about the same per-script resources as a mid-range Apple II, it has to be able to switch execution contexts as fast as shared microkernel threads, it has to be able to be reliably marshalled and unmarshalled with minimal execution time, and often launched and relaunched multiple times a second if it's in a vehicle or attachment.

So it would have been "we can do Lua or Tcl and I'm pretty sure we can get it working within 12-15 months, or I can write a straightforward standalone bytecode interpreter in a week".
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore