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

0
votes
1answer
22 views

How to run multiple Lua scripts within the same lua state without conflict

I've been working with Lua for sometime and there is a problem that I could never solve it. First, I'm using a single lua state to have a connection between my scripts so they could transfer data via ...
0
votes
2answers
63 views

Switching a project written in Lua to a compiled language

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, ...
2
votes
0answers
122 views

Lua Implementation

I'm struggling to get Lua implemented into my game engine. I've read dozens of blogs and articles revolving around how to wrap C++ classes and I seem to have hit a wall. No matter how I structure the ...
2
votes
1answer
172 views

How can I manage entities(in entity component system) using Lua scripts?

Suppose I have a code like this in C++ // Game.cpp Entity* hero; Entity* witch; ... // entity initialization if(/player near witch/) { if(hero->get<HealthComponent>()->getHealth() ...
3
votes
1answer
54 views

Make an object follow the mouse pointer with LÖVE2D

I've been trying to make a picture follow the mouse pointer with LÖVE2D. I want that the object follow the mouse, and not just be the mouse coordinates, I did that. So I toked the distance between ...
0
votes
1answer
40 views

Phone crash when try to use vibration on Android

Im developing an app that when you click a button the phone has to vibrate, the issue is that the phone just chashes. Saing that I need permitions to vibrate. I've already set this permition in the ...
0
votes
2answers
136 views

Smooth moving on tile-based map, how to fix simple collisions?

I've already had some experiences about the work of 2 dimensional square-based playfields and moving a player on them. Though, when a square has multiple pixel sizes, and player moves e.g. 1 pixel per ...
0
votes
1answer
41 views

file:write restarts Corona app

I am attempting to implement an auto-save feature into a mobile game. I have the following code writing to the save file: function saveFunc(input) local saveData=input local file = io.open( ...
2
votes
1answer
118 views

Generating transformation matrix for 2D camera with pan/zoom/rotate

Question How do you implement a camera with pan/zoom/rotation for a 2d game? Is it acceptable to multiply together a series of transformation matrixes to generate a final transformation matrix that ...
37
votes
7answers
5k 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 ...
0
votes
0answers
49 views

Gideros Repeating and Clipping Background

I want to have a background with a repeating x-axis, that can be moved horizontally. What I have so far: local background = Texture.new("parallax01.png", true, {wrap = Texture.REPEAT}) local shape = ...
1
vote
1answer
85 views

How should I go about protecting my script files?

I am working on a small multiplayer game with a whole bunch of scripting components. I know I can't store my files in plaintext otherwise anyone would be able to change the functionality of core ...
1
vote
2answers
104 views

Using Lua for configuration and localization data

Since my game is already going to be scripted with Lua, I've decided to make all my configuration and localization data defined using Lua tables. For example, this could be a basic locale file: -- ...
0
votes
1answer
85 views

How should I organize Lua scripts so that some entities do not have access to functions they shouldn't?

For my game in C++ I'm using different objects (like player, enemy, et cetera) which will have to be controlled by a Lua script. My problem is that if I were to write a function in my player script, ...
0
votes
0answers
42 views

Checking if two lines are crossing [duplicate]

How can I check if two lines (created with function love.graphics.line) are crossing themselves? I may use this ability to create procedural maps via graphs.
1
vote
2answers
238 views

Perlin Noise Help

Okay so I have been trying to make perlin noise, fractal noise to be specific, with mixed success. What I do is I fill 5 arrays with white noise, basically just floating point values. Each array is ...
1
vote
0answers
93 views

Determine required camera pitch/yaw change based on mouse movement and roll?

I'm sure this is going to be a pretty simple answer but I can't quite figure it out on my own. Each frame, I'm getting the mouse's distance from the center of the screen (left/up is positive) and ...
0
votes
1answer
78 views

How do I lock drawn lines to be orthogonal to an existing one?

I'm making a 2D game in Corona for Android/iPhone that is similar to Volfied. In my game, the user has to touch the screen to draw a line for the character to move along. How can I force the lines to ...
1
vote
2answers
190 views

Perlin Noise Variations

Currently I'm making a voxel survival game. About a month ago I embarked on procedurally generating terrain using Perlin noise. I understand how to use and apply it for the most part. However I do not ...
1
vote
1answer
103 views

How to set speed based on screen size

I am making a breakout clone for mobile and was wanting to make the ball speed to be related to the screen size. Larger screen would mean faster speed. Right now I have it set like so: ...
1
vote
2answers
100 views

Is it possible to develop web-based games using Corona SDK?

Some clients asked me to develop 2D web-based games and later on they might want to release those games on mobile platforms. I know Corona and I don't want to rewrite my code twice. Is it possible to ...
1
vote
1answer
294 views

How to store generic data in game database?

To clarify things a bit: I want to create a kind of database for my game, that simply is a class that stores all game-state information like object positions, player scores, etc. The main problem I ...
1
vote
2answers
130 views

LUA - Keeping track of game state for a digital card trading game

I am building a card game. Let's say it's similar to Magic the Gathering, Hearthstone, etc. The problem I am trying to figure out is how to architect "auras" and how much damage each card takes. ...
2
votes
2answers
84 views

Breakout intersection logic issues

I'm learning Lua and thought I should try my hand at making a Breakout clone. It is pretty much playable, but there seems to be odd intersection logic at some points, specifically the ball-brick ...
1
vote
0answers
41 views

Overlay scene not showing

I have 2 scenes: One main scene with a button, and another scene with only 1 text. button action in Main Scene: local options = { effect = "fade", time = 400, params = { ...
1
vote
1answer
108 views

How to allow other games to communicate with my Lua scripts?

I am planning some small games that will all rely on a single system of Lua scripts to manage some unified data about: Some achievements that are common to each game. The player's progress in ...
1
vote
0answers
34 views

Verb+Noun Parsers and Old School Visual Novels [duplicate]

Hi I'm working on a simple old school visual novel engine in Lua. Basically I have most of the code set up besides one important feature. The Text Parser. Lets get into how words are generally ...
1
vote
2answers
178 views

Store voxel type data in XML or Java classes?

So, I want it to be very easy to create all the entities of my game and for other people to come in and do the same. I was thinking I could just let the users/myself create an XML sheet the stores all ...
3
votes
1answer
430 views

How to transfer a luabind::object between two lua states

I store an object by a function call from Lua to C++ in first script in my application and after that I'll try to pass that object to other scripts and vice versa. A part of script class in C++: ...
5
votes
2answers
335 views

How to keep Lua bindings from cluttering up C++ code? [closed]

I'm writing a game engine that uses C++ and Lua (and Luabind). Currently, I'm writing all the bindings inside the constructor of the class being binded. I really don't like this because it's ...
1
vote
3answers
672 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 ...
1
vote
1answer
108 views

Starter love2d physics program not working

I am starting out with my first love2d (using LöVE 0.8) physics program. I am just creating some ground/floor, a car body and attaching two wheels with revolute joints and setting the motors a-go. ...
2
votes
2answers
579 views

How to bind std::map to Lua with LuaBind

Is this possible in lua to achieve? player.scripts["movement"].properties["stat"] = "stand" print (player.scripts["movement"].properties["stat"]) I've done getter method in c++ with this approach: ...
1
vote
1answer
2k 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 ...
2
votes
1answer
339 views

Scripting a sophisticated RTS AI with Lua

I'm planning to develop a somewhat sophisticated RTS AI (eg see BWAPI). have experience programming, but none in game development, so it seems easiest to start by scripting the AI of an existing game ...
1
vote
1answer
351 views

how to link a c++ object to a local variable in Lua

I'm completing my scripting interface with Lua, but recently I've stuck at some point. I have several functions for my Entitiy events like Update(). I have a function called create_entitiy() which ...
2
votes
1answer
145 views

How does one update the physical state of an object after scaling it in Corona?

I am new to Corona and Lua. I have the following question: I have an object cake with these physics parameters (doesn't really matters): ["cake1"] = { { ...
2
votes
1answer
3k views

why lua is so important ( frequently used ) in game development [duplicate]

I wrote some small games for fun myself, and never used LUA myself. but I can see people discussing lua used in games everywhere. I don't know what benefit I can get from using LUA in game ...
2
votes
1answer
287 views

Game Development AI, NPC & Entities Definition using Scripting Languages

i am developing a Multiplayer(actually MMORPG) architecture for learning purpose. I do have some game developement background, but all my engines were very rigid and completly developed for the game ...
0
votes
1answer
102 views

Why does this LUA code not render any objects on the screen? [closed]

Did I mess up something somewhere? If i put a putsxy in the same box, it renders a string just fine, but for some reason this code hates objects. What this code is supposed to do is render a set of ...
-1
votes
1answer
273 views

Overload C++ functions in lua [closed]

I have had a look around but I believe this to be impossible due to compile time of c++. However is it possible to have a class registered in lua and c++ that has a overload update function which I ...
0
votes
1answer
245 views

How to generate an explosion? [closed]

I'm currently working in an Angry Bird-esque game, where the user flings a bomb at buildings and the bomb explodes. How do I create explosions in Corona? Essentially some sort of area of effect ...
1
vote
1answer
421 views

Love2D : How can I keep up with lots of small sprites' collision data?

So I'm using a SpriteBatch to keep up with lots of small pieces for a falling-piece puzzle game. I have an array of Quads (for different color blocks), and they are randomly added to the ...
0
votes
1answer
264 views

Love2D : Problem rotating image in a SpriteBatch

I'm working on a falling blocks type of game with triangular pieces. I'm using a SpriteBatch to accumulate and remember the pieces and their locations. The problem is that when I rotate a scaled ...
0
votes
1answer
419 views

C++ formatted serialization [closed]

I've decided it's time to implement serialization in my simple engine but this has caused me many headaches for the past couple of days/weeks. My engine uses an entity/component based approach similar ...
7
votes
2answers
1k views

How to use LuaJIT the same that Lua in a C++ program?

I'm using Lua in my C++ program, as an library. But I read that LuaJIT is a better implementation. Is it posible to replace with LuaJIT with little change? How?
6
votes
2answers
463 views

How to share Lua script between instances?

I'm doing an agent based framework with C++ and Lua. I want to use Lua to code the Agent behaviour having an AgentClass class that have the name and source code and an AgentInstance class that have ...
3
votes
1answer
182 views

Platform independent replacement for LuaInterface

I'm currently working on a project in C#/XNA, however I'm planning to migrate this to MonoGame so that it can go onto more platforms. The problem is that I am currently using a lot of Lua, and for ...
3
votes
2answers
613 views

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

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 ...
2
votes
2answers
160 views

How might I script the creation of CLR objects?

I am looking for a method to script the creation of entities (arrays of components) for delivery through my entity factory, i.e scripted creation of .net objects. I have looked into Lua but it seems ...