Good vs. Evil

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

duckfan77

Popular Member
Mar 18, 2013
80
683
118
41 I understand some of that. Not that familiar with PHP, so that explains most of my confusion.
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
41 I understand some of that. Not that familiar with PHP, so that explains most of my confusion.
40 I only wrote lua today though :p

That is one of the reasons this new method is so much better. There are just a few variables you need to pass to it and it will work.
This can either be done by appending it to the script or by injecting it. Even passing the results back is now done inside that script though this can easily be overwritten (which I'm going to do on the php side, as that makes things easier and faster)

The result is that it is really easy to get it working inside WASM. Before this approach I had to find a way to get the needed values from JS over to C which passed it to lua and find a way to go the other way. (Mind you, I never wrote any C code, let alone C code that runs inside the browser)

Now, getting the results back is already implemented meaning I only need to pass some values from JS to Lua. Those values however have an easy and known structure, so at worst I can just have JS turn it in how you would write the data in Lua and add that to the beginning of the script. No need to pass it to C first or anything :)

(I also need a way to limit how long the script can run inside WASM. But first, get it working on the php side. Would be awesome if that also could be handled by lua itself though)
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
39 First question. WASM?
39 Web ASseMbly. Its a binary compile target which can run inside the browser. Though for now it isn't going to replace JS, its a lot faster and open the doors to use much more languages in the browser.

If you are a GM the script will run on the client instead of a server, this should (hopefully) reduce the load on the server by a good amount.
 

LordPINE

Well-Known Member
Jan 2, 2016
345
249
69
37. I just discovered Chromaticraft abilities can be adjusted in power, and immediately proceeded to creating a crater just next to my casting temple. Luckily did not hit anything important.
 
  • Like
Reactions: GamerwithnoGame

duckfan77

Popular Member
Mar 18, 2013
80
683
118
30
Web ASseMbly. Its a binary compile target which can run inside the browser. Though for now it isn't going to replace JS, its a lot faster and open the doors to use much more languages in the browser.

If you are a GM the script will run on the client instead of a server, this should (hopefully) reduce the load on the server by a good amount.

Ah, I head about that. Essentially precompiled JS, a la Java bytecode, which all major browsers have standardized on. Significantly faster than interpreting the JS in browser, and allows other languages to be compiled into it.
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
30


Ah, I head about that. Essentially precompiled JS, a la Java bytecode, which all major browsers have standardized on. Significantly faster than interpreting the JS in browser, and allows other languages to be compiled into it.
30 and on top of that, in firefox it can already start dealing with it while its being downloaded. Thus it can almost run directly after the last few bits are in, as opposed to JS where the browser needs to wait for the whole file before it can do anything meaningful with it.

In other news. I now have a function called
Code:
 real_array_shift_by_one
as php's array_shift function is a mess and freaks out and does all kinds of bad stuff when given an array created by Lua (1 indexed vs 0 indexed languages. Hooray). With bad stuff I mean, it doesn't just delete the wrong element and then shifts everything by one. It deletes MULTIPLE of the wrong elements inside the array and afterwards, it still doesn't work correctly when json_encoding it, and the fact that I need to json_encode it is the whole reason I needed to shift the values down by 1 to begin with >_>.
 

duckfan77

Popular Member
Mar 18, 2013
80
683
118
29 Why can the first index not just be standardized. I'd prefer 0, but even if it standardized on 1, that would be fine, as long is there was a standard.
 

GamerwithnoGame

Over-Achiever
Jan 29, 2015
2,808
1,507
224
27. I’ve not heard of that - I’ve only seen little bits of the original Dragonball, Dragonball Z and Dragonball GT series.