Questions tagged [lua]

Lua is a powerful, fast, lightweight, embeddable scripting language. Lua is widely used as a scripting language by game programmers, perhaps owing to how easy it is to embed, its fast execution, and its short learning curve.

Filter by
Sorted by
Tagged with
0
votes
0answers
6 views

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

In Roblox Studio, I have this code in a script file: ...
0
votes
0answers
27 views

Variable use in a Roblox Object statement?

I'm somewhat alright at Lua but I've only learned bits and pieces of what I need to code some transportation vehicles inside of Roblox. I'm trying to get a GUI interface of a subway model spawn to ...
1
vote
1answer
42 views

How to make object that moves with constant speed not overshoot the object it collides with?

To learn LOVE2D I am creating a simple project. Player moves the square with arrows keys until it hits the goal square, at which point the game is won. ...
0
votes
2answers
43 views

How to implement this XP formula?

I found this response but the thread is closed: https://gamedev.stackexchange.com/a/13639 level = constant * sqrt(XP) I seem unable to properly get current level, this is how I tried to do it, and ...
0
votes
0answers
27 views

how to register update function in Lua from C game engine?

This is my first attempt to make a SDL2 based 2d game engine in C, i am planning using Lua as scripting language for gameplay purposes. First i learned how to call a C function from Lua: ...
0
votes
2answers
68 views

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

With my past experience of having my little game lag because of the size of the world, I have decided that in whatever next project I might choose to create, I will split said world into chunks. Now ...
-1
votes
1answer
76 views

Roblox, custom chat filter

So, I would like to add my own chat filter to my game, how would I do this? eg: Player says: "DIE" Goes through chat filter and comes out as: "###" or any other string I specify.
1
vote
0answers
33 views

How to aim bullets at a player in Vavio

In Vavio, how do you make an enemy aim at the player then shoot a bullet? Here's the code I tried: LevelSpawnData/spawnData-L0.json ...
0
votes
1answer
101 views

AABB test does not consistently detect edge-to-edge contact when bounds are very different in size

My function compares two AABBs for collision detection, and when they are around the same size it works fine, but I noticed that if I greatly decreased the size of one of them (or augmented the size ...
0
votes
1answer
118 views

Walking around a sphere in Lumberyard

I am trying to create a simple game using Amazon Lumberyard and my goal is to have levels/stages where the player will be able to walk around a mini planet. I have seen a lot of tutorials about this ...
0
votes
1answer
76 views

What am I missing for this flycam to work correctly?

Through reverse engineering, I've found an instruction to inject on which allows me to obtain the XYZ coordinates of the camera, as well as pitch and yaw. Thus, I have the following: camX (Plane)...
0
votes
0answers
75 views

How can I load a script once in LuaJit/Lua and use it across multiple VMs in different threads?

So, I came across an interesting problem. I'm implementing some threaded game logic, and one of the things I decided to do was to use Multiple Lua VMs, with each worker thread containing its own VM. ...
1
vote
0answers
52 views

binding glm operators with luabridge

I am attempting to expose glm vector functions/data to luabridge like so: ...
0
votes
2answers
348 views

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

Hello I have a game using raycasting for the TI Nspire in Lua, and when the player faces a wall so that their degree they are facing is perpendicular to the length of the wall, I am having what is ...
0
votes
1answer
707 views

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

I just got started programming games and decided to try out love2d since I'm learning lua. I was wondering if anyone knows how I can create just a simple 2-3 button menu when you start up the game. ...
6
votes
1answer
441 views

Love2D game and editor in two separate programs

I'm building an engine in Love2D and I need to build an editor who will create scenes with game objects I wrote in lua. The thing is that there's this guy in my team who said : "Don't include the ...
0
votes
1answer
194 views

Love2D STI library not drawing map at all (black screen)

I'm trying to use a pretty standard map with the Simple Tiled Implementation module for Love2D, but no matter what I try, I can't get it to display anything but a black screen. Here's my current code (...
0
votes
0answers
21 views

Shortest rotation value [duplicate]

I have a top down game. The player moves the avatar with WASD where W rotates the avator to 180, S rotates to 0, A rotates to 90 and D rotates to 270. I also do diagonal movement so if they hold SA it ...
0
votes
1answer
44 views

Lua Unknown error when typing something in Zerobrane studio IDE

What is this weird error that I am getting when I typing something in the Zerobrane studio IDE? It crashes my IDE. But The game project compiles and runs fine. When I turn off "Autocomplete ...
1
vote
1answer
117 views

how to control units in a game using scripts

I'm looking to create a game like screeps, in which the user controls their units using javascript. I am planning on using lua as the scripting language that controls the units in my game, as it is ...
1
vote
3answers
418 views

Binding c++ templated functions to lua

I have started using Lua as a scripting language for my game engine. It works perfectly for things like input, audio etc. However, I'm now trying to bind my entity component system functions which ...
0
votes
1answer
171 views

Love2D how to zoom out map?

I've set up a basic map with Tiled, imported it with STI library (https://github.com/karai17/Simple-Tiled-Implementation) and everything looks in place. How can i get a zoom-out feature now? I can ...
15
votes
4answers
3k views

Procedurally generating a building of specific area

Myself and a team are working on a factory builder game that gives the player a random factory at the start of the game. To try to make sure there is a sense of "fairness," ideally the randomly ...
0
votes
1answer
335 views

Change transparency of image at runtime, LOVE2D

I would like to know how to take a defined image (e.g. a tile) in the LOVE game engine and draw it with a transparency that may vary per-frame. Stencils seem to only work for completely hiding parts ...
1
vote
0answers
179 views

Sprite batching and dealing with isometric depth sorting

So I'm using Love2D which uses SDL2* as far as I'm aware and I have a question about texture atlases & spritebatching. I have an isometric chunk, with 2 layers, terrain and objects (trees, ...
1
vote
1answer
156 views

Löve2d: How can i select object with mouse if it's overlap?

I have already some code but i can't solved this. How can i select one object with mouse if the objects are overlap? It's looks like solitaire game. I wish you can understand me... For example my ...
1
vote
0answers
130 views

interace between C and Lua function with 3D vector arguments [closed]

I have C++ function (which runs some physical simulation inside my game engine) which looks like this: ...
1
vote
1answer
40 views

Is it possible to have a fixed camera without a CameraSubject?

I have created a very simple script to set up a fixed camera with no subject. In other words, I want a camera in a static position looking down at the world (a top-down style camera that doesn't ...
0
votes
1answer
121 views

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

I have a method with this signature: const std::string GameObject::GetName() And then I try to bind it with this line: ...
0
votes
1answer
327 views

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

I am using sol2 lua wrapper for my 2D game-engine to implement some lua scripting,but I have some questions about what should functions should i call from Lua scripts in c++, and i cannot find any ...
0
votes
1answer
88 views

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

My game uses scripts that can be edited by the player and I'm trying to figure out how to handle multi-player, while still allowing custom scripts. What I am thinking about doing is having the server ...
3
votes
0answers
362 views

How to store Lua script's inner state?

Situation: I am working on an Entity-Component system, and I am using LuaBridge as a Lua binder. There is only one Lua State. Currently when I update the game objects, I just check whether it has a ...
1
vote
1answer
324 views

Should I create a Lua wrapper classes for my C++ classes, or should I bind them directly?

I have a fairly standard architecture like this: GameObjects have Transform, and can have ...
0
votes
2answers
484 views

Roblox script: Can't get “IntValue”?

I am new to Roblox scripting (Lua apparently) and was fiddling with a function that is called when one Part (dubbed the "Sender") is touched by another Part, which is actually a tool with a Part ...
0
votes
1answer
601 views

Lua script for World of Warcraft: Get Quest Info

I'm looking to make a very simple addon or even a macro where I can enter a quest ID and get the quest completion status. As it is, I know I can use ...
0
votes
2answers
61 views

Pressed key doesn't run out of special powerups

So I'm making a game in Lua/Love2D and have a problem with my game logic. Mainly I have a spaceship that can use boost and stuff. That part is fine, I click space and it boosts up to speed quickly. ...
0
votes
1answer
407 views

Love2D and 'Tiled' - Detect if player is over certain tile/Collision

I created a 50x50 tile map with 32x32 tiles in Tiled and exported it as a Lua file so I can use it in Love2D. I have a player you can move around the world but I'm attempting to convert the player's x ...
1
vote
0answers
218 views

Reimplemented steering seek behavior from PyGame to LÖVE is much slower than original

I'm learning about steering behaviors and watched this nice explanation tutorial - https://www.youtube.com/watch?v=g1jo_qsO5c4&feature=youtu.be with the source code available at https://github.com/...
1
vote
1answer
359 views

Difficulty understanding integration of Lua with C++ Game Engine

I'm starting work with the Allegro C++ library to get some lower level game development experience after working mostly with Unity. I've read about how Lua is a popular scripting language choice for ...
1
vote
2answers
542 views

Implementation details of Command Pattern in conjunction with Entity Component System

I have implemented an ECS where more or less an Entity is just an ID, a Component is just a wrapper for data, and a System holds the logic on operating over different components. There is an Engine ...
0
votes
1answer
603 views

Can MoonSharp call functions from static classes?

My question is very simple. I'm using MoonSharp to add Lua scripting to my game. One use case involves calling a static artificial intelligence function from a static class I've implemented in C#. I ...
4
votes
1answer
490 views

Garry's Mod gamemode scripting (lua) - How do I tell if an object is inside a hollow cylinder?

I'm fiddling about with gMod trying to make a gamemode where you have to throw a piece of cake into a cylinder that spawns on the map. This is the code I'm using to spawn the cylinder: ...
0
votes
1answer
216 views

C++ - Lua Preventing malicious lua code

Im working on a "game" that uses lua for scripting and i plan on making it very mod-able. However, malicious code can be written without much difficulty in lua... So how can i go about stopping that? ...
0
votes
1answer
135 views

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

I was just messing around with perlin noise and got this. Wondering if anyone knows what it is or has seen it before. Here is the code(LUA with love2d engine): ...
0
votes
1answer
146 views

Unwanted line between chunks in heightmap infinite terrain

I can't figure out what is causing the line between my two chunks. They are completely aligned. It must be something to do with the algorithm. I am using lua with the love2d game engine. Here is a ...
0
votes
2answers
583 views

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

I am using lua with the love2d engine to make infinite 2d tiled terrain with perlin noise. This is just the first step and I want to fix the bugs early. The problem is that there is no gradient ...
1
vote
2answers
1k views

Performance Issues Using Lua in C++

I'm making an engine in C++ with Lua for its scripting language (using LuaBridge as the binding). I have a lot of entities and those entities have components. One of the components on those entities ...
1
vote
1answer
147 views

Can i put the main Love2D functions inside a table?

Instead of having a file with load, update,and draw can i say have a table called player, then put love.update and love.draw in that table to handle the drawing and updating of that particular player?
0
votes
1answer
162 views

Z buffer for large vs small objects

Are there common, tried and tested techniques for making sure that when displaying very large and very small objects, in a 3D environment, those objects don't display in front or behind each other? ...
1
vote
1answer
53 views

How to automate baking pizza in Corona SDK?

I'm writing a game about making pizza in Corona SDK. When you buy chefs, the new chef is supposed to make some pizzas on its own like automation. I tried everything I knew about, I couldn't think of ...