# Tag Info

## Hot answers tagged lua

### Procedurally generating a building of specific area

A simple way to build a procedural generator is: Randomly build things Run a function that checks whether the output is good If the output is not good, go to step 1 Even if it takes thousands of ...
• 14.8k
Accepted

### Calculating Linear force required to hit a specific vertex on a parabola

Quick note: I don't know lua, however I am fairly good at maths/physics and please bear with me if I cover ideas you are already familiar with. For any object under the force of gravity the ...
• 501

### Procedurally generating a building of specific area

Given a restriction of "all areas are at are at least 3-4 blocks wide" the first idea that leaps to my mind is something like the following: pick one of 3x3, 3x4, 4x3 or 4x4 place a block of that ...
• 714
Accepted

### Procedurally generating a building of specific area

You could use pre-generated polyominoes as meta shapes to build an assortment of buildings. Let's say your minimum acceptable distance is 3 blocks. Then the smallest acceptable building unit we'll ...
• 11.6k
Accepted

### How do I get the player's position in Roblox Studio?

I feel your pain. Roblox is very confusing, despite their claims that it is an easy way to learn scripting. To get a player's position (server side) you need to access the player's character ...
Accepted

### var=time() vs time()=var pico8/lua

In math, the = sign represents the equality comparison operator, an assertion that "the thing on the left has the same value as the thing on the right." This operator is commutative: you can exchange ...
• 132k
Accepted

### Love2D game and editor in two separate programs

Alright, found it ! I had to add this to the main.lua file in the editor folder and it worked : package.path = package.path .. ";../?.lua" require "core.engine"
Accepted

### C++ - Lua Preventing malicious lua code

could block certain functions, but that wouldn't be nice for the modders It's perfectly nice for modders and is basically what everyone does. The only ones you need to restrict are the IO functions, ...
• 41.7k

### Is allowing the server to remotely execute code on a client a security risk?

You might want to ask yourself if you really need client-sided scripting at all. You might be able to make many interesting mods possible by simply making your network protocol powerful enough. Most ...
• 118k

### How can I correct an unwanted fisheye effect when drawing a scene with raycasting?

It looks like you're firing out your rays at evenly spaced angular intervals. ...
• 132k
Accepted

### How to properly split damage against armor?

If I've understood correctly, I'd do this as a two step process... Calculate how much the armor absorbs, then apply the rest to the player. Something like: ...
• 1,166
Accepted

### Implementation details of Command Pattern in conjunction with Entity Component System

How do I populate the execute command if there isn't any logic that "belongs" to an entity? But there is a mechanism for applying logic to an entity: Systems. In ECS, Systems map behavior to ...
• 398

### Performance Issues Using Lua in C++

I think part of the problem (which also caused me to misinterpret the question at first) is the lual_dofile() calls. This sounds like all scripts are always loaded ...
• 8,442
Accepted

### What functions should be called in C++ gameloop from Lua Script

I would generally recommend to avoid making high volume calls into Lua. That is partly about performance but mostly about engine architecture. To get the perf bit out of the way: the bridging code ...
• 41.7k
Accepted

### Const returning C++ method can't be bound with LuaBridge

Sounds like a bug in LuaBridge, so you should report it. As for fixing your project, just remove the const, it doesn't make sense anyway since you're returning a ...
• 1,168

### Create a game start-up menu screen with Lua/love 2d

There isn't a built-in menu system for love2d. The developers take a 'do-it-yourself' approach to a lot of such things. Here's an example of how I ended up rigging my menu for my first time: ...

### Any advantage of having chunks with sizes by the power of two?

The main advantage of power-of-two sizes is that division by a power of 2 (on an integer) is just a bit shift, and modding is just a mask. Both of these operations are blazingly fast to do on gobs of ...
• 132k
Accepted

### How to fix diagonal velocity being greater than axis-aligned?

Is there a fix for this so no matter what of the 8 I travel its the same speed? Yes... You want to apply a total force and split it between x and y To do this for any angle, you apply ...
• 1,166

### How to fix diagonal velocity being greater than axis-aligned?

You use trigonometry. Here we can just use the Pythagorean theorem: a² + b² = c² If the player is moving at a 45° angle, a and <...
• 4,961
Accepted

### HardonCollider Error: attempt to call method 'addRectangle' (a nil value)

Answering my own question here, in case somebody else encounters this issue. Looks like i have been reading outdated documentation & samples, according to the new docs there is no such method as <...
• 131

### How do I change a LÖVE2D game executable's icon?

The steps below are also covered in a video tutorial (icon topic starts at 2:22). Create an .ico file using GIMP, you can use the game.ico or ...
• 124
Accepted

### Dynamic force behind logical jumping on 3 axis'

So first, in the formula: velocity.x = x - ( x + ( 10 * math.cos ( ( rz + 90 ) * math.pi / 180 ) ) ); The two 'x's cancel out each other: ...
• 11.9k
Accepted

### Logical math behind jumping in a 3D world

It's the same as you'd do it for 2D, just with an extra axis. Use the same exact equations you do for a 2D game, something similar to the equations of motion or the kinematics equations. For each ...
• 73.2k

### My perlin noise height map doesn't have smooth transitions and goes directly from black to white

There is a bug in the final normalisation code, fortunately it’s easy to fix. You only need to change: map2[x][y] = map2[x][y] * mapMultiplier into: ...
• 23.8k

### Got unexpected results from perlin noise. Wondering what it is doing?

You are going outside the 0..255 range. That's why you see these color bands, since you are goint the whole range of values between 0..255 for every integer. You are multiplying by 255 twice. This ...
• 1,765
Accepted

### Can MoonSharp call functions from static classes?

One soulution could be creating a static callback function that in turn calls the function on the staic c# class so for exmple ...
• 126
Accepted

### Pressed key doesn't run out of special powerups

While the player holds down the space key, the else part of your code is never reached, so the deceleration is not applied. Basically, you'd have to execute this if ...
• 2,067
Accepted

### Roblox script: Can't get "IntValue"?

I think your misunderstanding is based around what val == not nil means. The expression not nil evaluates to ...
• 13.4k