This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Resident script pump circulation
#67
You've probably confused threads, but okWink

I very like JS. This is very modern, fast(fast among script languages) and expressive language with a lot of staff which Lua doesn't have.

I mean:
nice, fast, chainable array methods, and a few characters shortcuts (arrow functions)
Code:
// Javascript
const users = [{id: 1, balance: 100}, {id: 2, balance: 30}, {id: 3, balance: 80}]
users.find(u => u.id == 2).balance += 20;

-- Lua
users = {{id = 1, balance = 100}, {id = 2, balance = 30}, {id = 3, balance = 80}}
for i,u in ipairs(users) do
  if u.id == 2 then users[i].balance = users[i].balance + 20 end
end

Maybe this is stupid example but I like this array methods in JS and also that array are passed by reference.
Creating objects is also very easy (also without classes).

Another advantage of JS is its community and thousands of libraries.

But unfortunately LuaJIT is faster so JS could be(but now it is not possible) only used via NODEJS only as a support for this main technology on server.

But on client you have now JS and you can use it. And when you generate something via .lp file you can via Lua prepare raw data and in JS do most of work.

But also without JS on server I will like LM because this is very, very nice device for creating powerful logic in a lot of powerful waysWink
Done is better than perfect
Reply


Messages In This Thread
RE: Resident script pump circulation - by buuuudzik - 30.10.2018, 15:13

Forum Jump: