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.

learn more… | top users | synonyms

1
vote
0answers
7 views

How to include moai in lua code for running it using luajit?

I'm running moai from ubuntu for some simulation purposes. I have a lua script that is executed using luaJIT. Now I want to run a simulation written based on moai from within this script. As of now,...
1
vote
2answers
39 views

How do I handle objects with a width and height in grid-based pathfinding?

I'm using the Jumper library for Love2D to do grid-based pathfinding, which worked fine until I wanted to make larger enemies (with larger collision boxes). How do i do that? My initial idea was to ...
52
votes
6answers
21k views

How does Lua work as a scripting language in games?

I'm a little hazy on what exactly Lua is and how a game that is programmed in C++ would use it. I'm asking primarily about how it is compiled and run. For instance when you use a program written in C+...
2
votes
1answer
127 views

Passing an SDL KeyboardState(Uint8*) to Lua

I'm working on my first big project and I've decided to integrate Lua with my C++ framework. Everything's worked out so far, but the only way I've managed to pass the SDL_GetKeyboardState(NULL) array ...
1
vote
0answers
34 views

How to fix my camera angle in ROBLOX?

I am trying to make my own camera in ROBLOX. Here's my problem, I am using an inverse function to make the camera look nice and smooth but it only works on the x axis in the positive side. Here's an ...
0
votes
2answers
30 views

What does this shader error in Löve2D mean?

What could I've done wrong to get the following error message when trying to create a GLSL shader in Löve2D? I'm sincerely clueless of what the mistake could be, though I suspect the error being a ...
0
votes
1answer
17 views

How can I fix this code to spawn multiple types of enemies on the same point with the Corona SdDK?

I have this code to spawn a simple enemy outside the window: local function spawnGrupo1() local color01 = display.newImage("assets/img/enemigos/blue.png") color01.x = 40 color01.y = -50 ...
0
votes
0answers
27 views

Spawning multiple objects randomly

I have gold spawning all the time though I sometimes ( rarely ) want to spawn a gem, and at other times I want to spawn boosts, how would I make a function to choose between what item to spawn. I ...
0
votes
1answer
18 views

How do I select a portion of the window using Love2d

I want to be able to divide the window of the game in, lets say, 3 places, and when the mouse (or touch) click one of those places, execute some code. Do I have to make each portion a button-like ...
4
votes
3answers
159 views

Scripting: to block or not to block

Context: I'm making a little "program your robot army" sort of game in Java in which the player writes Lua scripts (which are then run by LuaJ) to program their robots to do stuff. So far there are ...
0
votes
1answer
44 views

Console Invoke from Lua

Is there any possible way I can invoke the console with lua? The documentation for cryengine lua functions isn't very helpful.
6
votes
2answers
610 views

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

I merged my game.love file and the love.exe with the command copy /b love.exe+app.love game.exe. But the resulting executable has the default LÖVE2D icon. Is there a way to change that icon to ...
0
votes
1answer
15 views

How to calculate the magnitude of the drag in Corona-sdk?

I'm making a game on Corona that launches a ball. The force is based on the magnitude of the drag: the larger is the drag -> the higher is the force. I'm having some trouble to do this, because I ...
0
votes
0answers
29 views

What's the best way to store tiles' infos in a 2D table?

I need to know what's the less time / memory consuming way to store the infos about each tile in a 2D table. The first thing that came to my mind was creating a table holding the infos, and then ...
1
vote
1answer
56 views

Dynamic force behind logical jumping on 3 axis'

I've been working on physical jumping in a 3D environment, I've got it working with a static force. The problem with this is that the force on each axis should be different due to the rotation from ...
1
vote
1answer
72 views

Logical math behind jumping in a 3D world

I'm unsure if I should ask the mathematic part of StackOverflow or the gamedev part. I'm trying to figure out how the gravity changes the position of an element in a 3D world. I've been trying to ...
0
votes
0answers
51 views

Why does my world generation code perform poorly on large inputs?

I'm writing some code to procedurally generate some islands in real time. The idea is to choose some points for each chunk, and for each tile calculate the distance from those points, then combine it ...
1
vote
1answer
201 views

NLua - How to implement Roblox like function security?

Roblox uses Normal Identities, basicly they assign a lua block/object to a certain number. They use 2 for Scripts and LocalScripts, which can only use non-secured functions, while the command bar can ...
3
votes
0answers
63 views

Easing towards stepped value

I'm currently developing this rhythm game in lua (on top of a c++ engine) and I'm having trouble keeping a steady playhead position for the song currently playing. The playhead position that the ...
1
vote
1answer
93 views

In ROBLOX, how can I check what is in front of me?

In ROBLOX Studio I need to check what part is in front of the model Freddy. I need to set the variable called thingInFront to the part that is in front of the model Freddy so that I can decide ...
0
votes
1answer
123 views

Is it safe to set Lua Table data from multiple C++ threads?

As the title states. I'm curious if it's safe to set data in different Lua tables that exist in the same lua state. From multiple C++ threads. I'm asking this because my current system actually has a ...
0
votes
0answers
20 views

Wow backdrop adding a fade color

I'm a bit stuck on my frame border. It adds 3 lines at the border and it should be 2 and i can't seem to fix it. Here is a image for better understanding. My backdrop looks like this PANEL_3 = { ...
0
votes
0answers
17 views

Cocos2dx : Lua with C++: lua_pcall closing my app

I'll try to explain what is happening with my current project: I want to make some custom scripts myself without using the lua script engine from cocos2dx, so I linked lua51.lib on Linker->Input, and ...
1
vote
0answers
39 views

GMod Lua Scripting - Playing sounds only for specified player entities

I'm making a game mode for Garry's Mod, and I'm trying to write a system in which I play sounds only for certain players. The problem I'm running across is that doing so from server-side would take a ...
3
votes
2answers
7k views

2D and 3D Perlin Noise Terrain Generation

I'm using 2d perlin noise to generate a heightmap and then adding 3d perlin noise to the heightmap to create overhangs and ridges. But it's not turning out like I would like it to. There are too many ...
3
votes
2answers
1k views

Does it make sense to use Lua scripting in a game developed in Python? [closed]

Well for C++ written games using Lua scripts for easy changing ai, quets etc is very reasonable and it's common. However now I'm going to write a game in pure python and I don't know if I should use ...
0
votes
2answers
176 views

Switching a project written in Lua to a compiled language [closed]

I am experimenting with game development in Lua using the Love2D framework, and while it works fine, I am getting tired of using a dynamic scripting language. I would like to have better performance, ...
1
vote
2answers
67 views

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

I want to add collision detection mechanism to my game, which is written in love2d. As i do not want to implement my own algorithm, i have found a HardonCollider library to do the heavy lifting for me....
0
votes
1answer
57 views

Corona SDK, do I need to pay for it?

I'm a single dev making simple mobile games. I was looking at corona sdk for my next project. I don't understand what the difference between the paid version and the free version is. It seems that ...
6
votes
0answers
117 views

Design patterns for live coding/script reloading [closed]

I would like to make C++/Lua combo and write scripts for a game with live script reloading. What design patterns should I be aware of so not to cause me unnecessary pain? For example if I have a ...
1
vote
2answers
108 views

How do i set Lua variables?

You can pretty easily read variables, but what about writing them to the lua file? Ive given it a little go, but it doesnt seem to work... void Lua::setBool(string path, string var, bool val) { //"...
3
votes
4answers
2k views

Is it efficient to use lua to store game data?

I'm new to lua and I'm wondering, is it efficient to use lua to store game data (such as monster's description, spells). My problem is, when I try to create a monster object every second, I have to ...
2
votes
2answers
82 views

LUA form/scene loading

At the moment, I'm working on a small game project using LUA and the love2d framework. Using this framework, I've made my own assets (i.e. button images, form images, etc), and using these assets I've ...
1
vote
2answers
94 views

Binding class method to Lua

If I have class class Game { public: Game() { level = new Level(); } private: Level *level; lua_State *L; } Where the level class has member functions such as "...
8
votes
2answers
157 views

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

The idea is a user presses somewhere on the screen and the program will fire an object in a parabola shape from a defined start position that has it's vertex where the user touched the screen. I have ...
0
votes
0answers
41 views

Balancing teams based on player count and skill

I am creating a lua script which should balance teams. Now I have a table of players for each team. And each player has a certain skill (float value), and well second problem is the player count in ...
0
votes
0answers
28 views

How can I clear the screen on Corona SDK

I have objects on the screen that create the main menu, and I want the the screen to clear when I get press the play button. I did it the way the other question on this subject said, but when I ...
1
vote
1answer
60 views

Resource management with Lua integration

I have a questions about how to better implement resource management when integrating with Lua. I have an entity system that has gameplay logic done in Lua. One of the design points was that I wanted ...
1
vote
1answer
110 views

Multiple lua scripts using newthread

I'm trying to hook lua-scripts to my entities, where several entities of the same type want to use a separate instance of the same script. Problem is, when I run two or more scripts and use any C-api ...
1
vote
3answers
2k views

corona sdk scale images

How to scale images to full screen on all devices, i want to use % The method I've seen so far is to define pixels image_variable_name = display.newImage( "testimage.jpg", 100, 300 ) I want to do ...
0
votes
1answer
291 views

load all files out of folder as resources in lua and love2d [closed]

If i use this code -- some lua file -- some code local IMAGE_FILES = {"file1";"file2";"file3";"file4} -- some code function loadRes() -- some code -- load all images: for i,v in ipairs(...
0
votes
1answer
146 views

Calculate future 3D Position of object(Unit)?

I've looked around and almost all examples is see have a velocity vector which I do not have, or at this point am unable to figure out. Im trying to find the 3D position where i can launch a trap in ...
6
votes
3answers
196 views

Which parts of game should belong to engine and which should belong to scripts?

Often, the game is splitted into engine code (i.e. C++) and scripts (i.e. Lua). The question is which parts / modules of game code should typically belong to engine, and wchich should belong ...
1
vote
0answers
170 views

What LuaJit threading archietecture should I use?

I am in the process of designing my own Game Engine for use in a real time CRPG - think Baulder's Gate. I know most of my specifications right now, and I am currently in a planning phase. I chose Lua ...
0
votes
1answer
733 views

Garry's Mod HatsChat2 chat colors permissions messed up?

So I'm making a garry's mod server and I'm trying to work on my chat box addon that I installed and was working on that only premium and superadmin can use colors in the chat and only want them to be ...
1
vote
1answer
94 views

LOVE Physics - Joint Stretching

After asking a similar question yesterday I've come across another problem with using joints in box2D / LOVE and trying to create a weighted chain. Everything is set up as follows, I've tried to ...
1
vote
1answer
160 views

LOVE Physics - Breaking Joint Chains (LUA / Box2D)

Wasn't sure whether to post here or on SO so please move if needed. I've been having a look into the box2D physics API provided by LOVE to try and create a swinging flail or weighted rope but I'm ...
1
vote
1answer
206 views

Registering a C++ callback with Lua API without additional libraries

Basically, I'm trying to register a callback into a Lua state like this: class MyClass { public: int myLuaFunction(lua_State* L) { //do something } }; I ...
0
votes
1answer
37 views

Nested ipairs for basic hit detection

So i'm developing my first game using Löve, the game is a basic asteroids clone. Everything is going well so far, until I decided to actually add asteroids. I'm trying to make a basic hit-detection ...
0
votes
0answers
73 views

How to implement Lua thread for Sleep function

I am running into a problem in my game engine right now. I want to be able to call Sleep(number_of_seconds) from .lua file (1 only) and halt the execution of the lua file, WHILE the game is running ...