The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
3
votes
1answer
69 views

How to make the player unable to change some of the game elements?

I am making a text turn based RPG fighting game in which you create your own spells. You also share them as JSON files with your friends. Sharing is required to win. The game is designed so that it ...
0
votes
1answer
27 views

How to make the character dash forward in Roblox?

In my game I want to make a skill in a tool to dash forward for a specific range and if the character came in contact with a humanoid during the dash, it stops right on contact and stops the other ...
0
votes
1answer
21 views

Command Shell text adventure - input methods for scrolling through text (lua)

I'm writing a simple text-based adventure in lua. The intent is the user clicks on the game.exe and it loads up the command prompt or whatever command shell they have and they play the game there. ...
1
vote
1answer
35 views

how to display current time as a static value in lua/pico8

Pico8 has a function time() that when called displays the current time from start of program. i.e. print(time(),0,0,14) --prints time at (0,0) with colour 14 However the function doesn't stop and ...
0
votes
1answer
26 views

Why is the button's code not running?

My script for a slot machine isn't working. When the button in the Bilboard GUI is clicked, the below dosen't run. I am new to scripting and this is mostly based on wiki/stack exchange/ Dev page info. ...
0
votes
2answers
38 views

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

time() is a preset function in pico8 gameengine. I don't understand whatsoever why I get an error when I write: time() = var But it's fine if I write (where var is any variable) var = time() What ...
0
votes
0answers
35 views

How can I store “charges” on a player persistently between game sessions

I've got an idea for a gamemode for a Garrysmod RP server but I don't know if it's realistic within Lua. I specifically want to make my script apply variables to a person when they shoot another ...
0
votes
0answers
43 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
39 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
48 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
50 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
28 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
71 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 ...
0
votes
1answer
96 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
34 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
111 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
133 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
88 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
84 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
71 views

binding glm operators with luabridge

I am attempting to expose glm vector functions/data to luabridge like so: ...
0
votes
2answers
421 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
804 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
457 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
248 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
45 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
123 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
484 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
197 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
358 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
191 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
160 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
142 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
48 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
131 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
372 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
90 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
397 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
349 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
538 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
704 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
62 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
430 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
232 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
389 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
610 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
646 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
557 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
224 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? ...