Posts by Klaider • 2,509 points
154 posts
-
1
votes1
answer54
viewsA: How to concatenate a variable in Actionscript 3?
Before that assume that this is DisplayObjectContainer. In general you can try: MovieClip(this.getChildByName('p'+ n)).gotoAndPlay(2) // assumindo que ` mc_1.name = 'p1' ` (Using lists in addition…
-
0
votes1
answer115
viewsQ: No less `csc` works on Mono
Mono is a set of build tools. Before and after version 5.0, the Mono tools never worked, except csc. To clarify, although the version is not related to the problem, since the version 5.0 Mono has…
-
1
votes3
answers237
viewsA: Modules in Rust
All file import goes to the main file, ie the relative of all: main rs. mod game; mod game_state; To refer to game inside game_state, can use: game_state.rs use super::game; That is, the same of…
-
4
votes1
answer64
views -
1
votes1
answer187
viewsA: How to declare "strings" accented strings?
Terminology. In his example é="eu", you would call é of a identifier or name. Responding. A Lua code is divided into: grammar and syntax. Syntax depends on grammar (as the sole lexical objective, on…
-
0
votes1
answer142
viewsA: Is there a table breaker in Lua?
Table vázia? A table is varied if next(t) == nil, or if tamanhoDaArray <= 0 or tamanhoDaArray == 0. Comparing tables (x = y) There are several different ways to check if one table is equal to…
-
0
votes2
answers825
viewsA: How to redeem checkbox value in the form using serialize()?
With jQuery you can do this basically: // Conversão de formulário para objeto Array var dados = $(this).serializeArray(); // Conversão de objeto para URL var query = $.param(dados); dados should be…
-
12
votes1
answer433
viewsA: Transponders in Ecmascript
Characters allowed What are the characters allowed within an identifier in ES6? To begin with, the name of an identifier (IdentifierName, which gives rise to Identifier) is specified in this…
-
1
votes1
answer50
viewsQ: Band operation with 64 bits
I know that on Moon 5.3 (demonstration) there are 64 bit operators, such as: print(0xaaDbc4Cd17Af & 0xff00000000) --> DB 00 00 00 00 Is there an algorithm to perform a similar operation in…
-
0
votes1
answer37
viewsQ: Create type using a structure class, and use the same type within the class
Currently I need to create a collection of classes that represent nodes (fragments) of the AST (abstract syntactic tree) of an interpreter. Now, for example, I gave an overview of the C++ templates…
-
1
votes1
answer51
viewsA: Is there any way to modify what the module will return in Lua?
I think it would be easier to adapt a class to your Inventory module. Otherwise, it seems that it is only possible to update the value of a module in versions of the Moon larger than 5.0, accessing…
-
0
votes1
answer43
viewsA: how to access non-standard javascript properties
If you refer to attributes represented in XML, you access them similarly as in the current class HTMLElement. let elem = xmlDoc.getElementById `plid_5` console.log( elem.attributes.uri.value,…
javascriptanswered Klaider 2,509 -
0
votes2
answers192
viewsA: How to define conditional properties for a literal object in the leanest way possible with Javascript?
It is possible to resolve the action of defining that property (recognized as [[PUT]] by the Ecmascript specifications, or "set"), or reading ([[GET]], or "get") on the object. This is only directly…
-
0
votes1
answer65
viewsA: Variable value seems not to change according to loop
The problem is that the variable total is always being declared in the current scope, not in the block of for... in (and you always refer to the same variable). For example, the line: var total =…
-
0
votes2
answers77
viewsA: String#codePointAt or String#charCodeAt?
The difference is simple. First, a value of type String (most expressed as "string") stores a sequence of non-negative integer numbers, the size of 2 bytes (16 bits), called "elements" to facilitate…
-
0
votes2
answers993
viewsA: Count total of arrays in Javascript:
This solution below uses a recursive function and checks the properties of each object. If you pass primitive values in the for... in will give a stack overflow with strings (because at least in…
-
1
votes1
answer50
viewsQ: What to use: "typed array" or Dataview?
In Ecmascript 6 there is a new class DataView, and "typed arrays" (apparently supported in Internet Explorer 10 and 11), used to manipulate ArrayBuffer's. What is the difference between DataView and…
javascriptasked Klaider 2,509 -
1
votes1
answer50
viewsA: What to use: "typed array" or Dataview?
Knowing that ArrayBuffer represents binary data in the browser memory (a collection of fixed-size bytes), the so-called "typed arrays" and the DataView allows us to manipulate this collection of…
javascriptanswered Klaider 2,509 -
2
votes2
answers175
viewsA: What is the difference between local`Function var` and local`var = Function...`?
The difference is how the local variable can be accessed by its own value (currently a function). First you need to know that the declaration of a local variable is not available in its entire scope…
-
0
votes1
answer73
viewsA: Referencing an import dynamically
I know almost nothing about the modules' syntax implemented in ES6, although it has an overview of how it works on that page (but usually the Mozilla documentation is wrong/incomplete in my…
-
3
votes3
answers1185
viewsA: How to insert a new value into an array without duplicating through the switch case?
Just check if the value obtained does not exist in the collection (as the title already says), then pull it directly into it. Your verification of the checar seems to be wrong. This code will do the…
-
1
votes2
answers634
viewsA: How to read a JSON using JAVASCRIPT ONLY?
In addition to the basic example you have to worry about the file cache (by your question, I recognize that it is a file), remembering that it must be hosted (the browser does not allow requests on…
-
3
votes2
answers586
viewsA: Scope between variables - Javascript
That’s what you’re talking about ("You can view the file variable 1.js through a Function") could be possible in different ways, but the browser API does not directly enable it. It would be better…
-
2
votes2
answers175
viewsQ: What is the difference between local`Function var` and local`var = Function...`?
There are two ways to declare a local function directly. local var = function() end; and local function var() end What’s the difference between them?…
-
-4
votes1
answer91
viewsQ: Long Comments and Long Strings
I would like an appropriate explanation of what they are Long Comments and Long Strings, although they may be small resources.
-
2
votes1
answer91
viewsA: Long Comments and Long Strings
Long Comments (long comments) are comments using Long Format. Long Strings (long strings) represent strings, but also using Long Format. Long Format Long Format (long format) is a format that…
-
4
votes2
answers823
viewsA: How to Manipulate UTF-8 on the Moon
To add, in version 5.3 there is a special syntax to encode the code of a character (almost equal to utf8.char): local chr = '\u{código}'; code: a hexadecimal code. The difference is that the syntax…
-
3
votes2
answers823
viewsQ: How to Manipulate UTF-8 on the Moon
How to work with a string composed of UTF-8 encoding on the Moon? For example: get a character code in a string by its index; encode character codes, something like string.char(...códigos) or…
-
1
votes1
answer166
viewsQ: Symbol ; on the Moon
How the symbol works ; on the moon? ;;;; ; ; do ; end; do ;end do ;end; do;end; ;do end ;do end; ;do ; end; ;;do ; end do end
-
6
votes1
answer166
viewsA: Symbol ; on the Moon
*Obs.: statement is not an expressive instruction.* Basically semicolons (the symbols ;) separate statements, but in version 5.2 there is a simple change. Old-fashioned Up to version 5.1, the…
-
1
votes2
answers963
viewsA: Is there a way to use accents in strings in LUA?
This depends on how the string is interpreted by the renderer. For example, maybe the renderer treats each byte of the string as a character code, or in other cases it can base the reading of…
-
1
votes2
answers77
viewsQ: String#codePointAt or String#charCodeAt?
New methods similar to Ecmascript 6 have been added to String.fromCharCode() and String#charCodeAt(): String.fromCodePoint() and String#codePointAt(). What’s the difference between them?…
-
3
votes1
answer145
viewsA: Lua: Make the Lua garbage collector collect unique(as) objects/tables referenced by a table
In version 5.0 (except in the versions below, I believe) or above there is a way, making the table tables in a Weak table. Actually the table won’t be a Weak table, there will be an option to make…
-
-4
votes1
answer145
viewsQ: Lua: Make the Lua garbage collector collect unique(as) objects/tables referenced by a table
Let’s assume I have a table that stores information on 200 tables, local rand = math.random; --[=[ - Uma tabela que armazena uma informação - sobre tabelas específicas - (Cada campo contém uma chave…
-
-9
votes1
answer388
viewsQ: What are weak tables?
What are Weak Tables (weak tables) in version 5.0 Lua? When to use them?
-
4
votes6
answers66760
viewsA: "foreach" in Javascript
In addition to all existing answers, there is the for... of Ecmascript 6 (i.e., new :/) which traverses object values including a special property Symbol.iterator (this property is a symbol... and…
-
23
votes1
answer433
viewsQ: Transponders in Ecmascript
What are the allowed characters, or what is allowed, within a name (known as "identifier") in the Ecmascript 6? Has rules between identifiers and keywords???…
-
0
votes1
answer224
viewsQ: Javascript: How is self used?
What is the specialty of self, a global property that refers to the global object itself? console.log(self === this, this.self === this, window.self === this, self.self === this);…
javascriptasked Klaider 2,509 -
9
votes3
answers998
viewsA: Responsive font according to text size
I think you can recreate the element that makes up the name of the song, and get its width in pixels. If your width is larger than the width of your container, you can resolve to create a…
-
4
votes1
answer118
viewsQ: When a function is executed a new thread object is created?
According to the manual of version 5.3, a thread type value represents independent execution topics: The type thread represents Independent threads of Execution and it is used to implement…
-
0
votes1
answer45
viewsA: How do I wait until a condition is given in LOVE2D?
The function wait makes use of coroutines, so this should work normally. Or already tried to use timer.every? timer.every(0, function() if condição then --[=[ Ação final ]=] -- Acaba por aqui.…
-
1
votes3
answers151
viewsA: Separate bytes that form an integer number?
With the help of some comments on my other question i managed to simplify my function to return 2 fixed bytes: local function InParts(num) return (num & (0xff << 8)) >> 8, num &…
-
4
votes3
answers151
viewsQ: Separate bytes that form an integer number?
Assuming I have this positive number: local uint = 2000; how can I get the bytes that compose it separately? For example: print(sepbytes(uint)); -- 7, 208 My attempt: local function sepbytes(cur)…
-
5
votes2
answers141
viewsA: How do I make some image invisible in love2d?
An alternative to my comment and my previous response is to use the method setColor before drawing the image. local opacidade = .5; -- de 0 à 1 love.graphics.setColor(0xFF, 0xFF, 0xFF, 0xFF *…
-
1
votes2
answers141
viewsA: How do I make some image invisible in love2d?
Based on my comment, it is possible to define the visibility of an image by copying its data, mapping its pixels to modify the alpha field, and in the end create another image through the modified…
-
0
votes1
answer82
viewsA: Is there a way to stop a Tweening in ROBLOX studio?
At the moment it is not possible, but defining the fifth (natively sixth) argument of this call if it becomes possible to replace your Tweening with another. (Unfortunately there’s no way I know if…
-
1
votes2
answers413
viewsA: How do I return a particular character from a text?
The reply of @Gomiero is super correct. Additionally, I recommend using a library to manipulate strings that use byte-based encodings. This is not complicated, and is essential since usually only…
-
0
votes1
answer95
viewsA: How do I use Hump.timer in a repeat loop in LOVE2D?
I recommend not using a native loop to change the x-string of the image. I call it synchronous work. While this loop runs, the program will be stopped (but the imgx will yet change). (If you ever…
-
2
votes1
answer42
viewsQ: Creating bytes collection in old browsers through Javascript?
I wonder if there’s such a thing as Uint8Array in older browsers (at least IE8), a collection type with elements that occupy only 1 byte of browser memory. An approach would be to use strings,…
-
4
votes7
answers12436
viewsA: Use semicolon or not at the end of the lines in Javascript?
First I would like to point out that the semicolon sometimes separates statements (when I refer to 'statements' I refer to statements, utterances and other instructions that may appear in ordinary…