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
1
vote
0answers
28 views

Binding Lua Function to Perform tasks using std::async

I am trying to load a bunch of mesh resources in the format of .obj files. Some of the files are very high in poly count so when loading using the below method It takes more than 10 seconds. I would ...
-1
votes
0answers
15 views

Is there a better way to organize this hairy collision code?

I have a lot of nested for loops is there a better way to organize this code? ...
0
votes
0answers
27 views

How would I delete lazers out of bounds

I have a list of lazers(bullets) that i would like to delete specific instances from. How would I go about doing that with the code I have now? I first tried to pass in the player to a lazer instance ...
1
vote
0answers
21 views

How to connect a GUI button to function?

I am developing a new Roblox game where you can setup and control you're own virtual machine using SurfaceGUIs on a modeled screen. I am trying to make a confirmation GUI where if you click YES, then ...
1
vote
0answers
80 views

Optimizing falling sand simulation

So, for the past couple of weeks, I've been working on a falling sand simulation inspired by games such as The Powder Toy, Noita, and Sandspiel. I've been making it in Love2D and I'm please with what ...
0
votes
0answers
15 views

How do I add custom logic to a World of Warcraft internal LUA event using an addon?

I'm trying to show a bit of custom text directly after mount names in the World of Warcraft Mount Journal. I've exported the Blizzard API code from the World of Warcraft client, found the method I ...
0
votes
1answer
23 views

When PlayerRemoving event is fired, for loop does not work properly

while I was implementing the Backback save feature in my Roblox Game (using game.Players.PlayerRemoving:Connect(), I found that when I used a loop of any form (<...
0
votes
0answers
99 views

Hiding World of Warcraft UI Elements with Lua

I'm tyring to make a very simple WoW addon that hides the gryphons on either side of the main menu bar and hides the micro buttons in the lower right. The addon has one Lua script, main.lua: ...
0
votes
0answers
50 views

Integrating Moonsharp with Unity for Nintendo Switch project

Has anyone tried to run Unity project with integrated Moonsharp on Nintendo Switch? Can it be done? Are there any significant performance issues due to running Lua scripts? EDIT: Sorry, I wasn't ...
0
votes
0answers
48 views

Facing issues trying to Parse JSON in Lua

Problem statement: Need help trying to load a JSON file into a table array in Lua for Corona SDK development. My Objective: Call specific data from JSON file to my application by using key value ...
0
votes
0answers
105 views

Need some help for reading JSON/XML structured files in Lua language for Corona SDK

I have been trying to read a JSON/XML or simple text file in Lua language for Corona SDK with little to no success. All the tutorials I followed, people were basically writing a file and then reading ...
0
votes
1answer
94 views

How is tile offsetting accomplished in 2d side scrollers?

The idea is to work with tiles that together make up a larger image, or world so to speak. but im confused as to what the methods used are to offset the tiles, and whether is a good idea to draw ...
3
votes
1answer
87 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
2answers
413 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
37 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. ...
2
votes
2answers
102 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
28 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. ...
1
vote
2answers
47 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
39 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
2answers
1k views

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

In Roblox Studio, I have this code in a script file: ...
1
vote
1answer
69 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
88 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
2answers
78 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
151 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
37 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
136 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
202 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
100 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
101 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
108 views

binding glm operators with luabridge

I am attempting to expose glm vector functions/data to luabridge like so: ...
1
vote
2answers
769 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
1k 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
492 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
502 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
22 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
48 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
130 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
648 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
249 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 ...
1
vote
1answer
462 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
241 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
185 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
152 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
89 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
144 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
517 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
95 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
478 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
446 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 ...

1
2 3 4 5