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

31
votes
7answers
4k 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 ...
-1
votes
0answers
18 views

Free iphone app to use lua? [on hold]

Is there a free iphone app that I can use lua in? I have touch lua but I dont have the money to buy the draw library and the turtle library
0
votes
0answers
16 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
71 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
72 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
73 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
41 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
171 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
67 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
66 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
122 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
87 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
83 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
206 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 ...
0
votes
2answers
95 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
77 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
31 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
96 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 ...
0
votes
0answers
29 views

Binding globals to lua editors

Is it possible in any existing IDE for Lua to somehow define globals, modules etc. that my potential application would bind to lua_State? It'd be neat to see code completion feature that works with ...
0
votes
0answers
36 views

Lua 2D Table Initlization Efficience

I want to implement a grid table include row, column like this: GridTable = { [row] = { [column] = { location = {x,y} }} } Set the row = 200, column = 200, to initlize the talbe in the for loop ...
1
vote
2answers
164 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
361 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
307 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
412 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
76 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
471 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 ...
1
vote
1answer
247 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
256 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
128 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
2k 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
249 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
0answers
93 views

Tile-Based Platformer Infinite Terrain Generation [duplicate]

I'm using the LÖVE game engine (which uses Lua). My terrain generation works good. But I'm planning to make the terrain generate as the player walks so that the terrain will be infinite size. I'm ...
0
votes
1answer
97 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
213 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
214 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
0answers
350 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
227 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
350 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
361 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
178 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
528 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
155 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 ...
1
vote
1answer
270 views

How can you implement Lua into your game? [closed]

I am trying to implement Lua into my game, but am having trouble. Say I have a weapon class, which is just a hollow shell, lacking real functions. I was thinking of creating an onFire function, which ...
3
votes
3answers
1k views

How should I manage the AI using lua scripts?

My game is in C++ and I want to make AI being managed by lua scripts, but I have no idea how should the scripts look like and the integration in C++. Should the script be like if ...
1
vote
2answers
126 views

Rotating and pitching a turret

I am new to game development and I was trying to build a turret model, and control it through lua script in shiva3d. I can rotate it around the y axis which is no problem, but when it comes to ...
1
vote
1answer
112 views

update image properties

Is there a way to update the location of an image? I'm currently calling my image dynamically using: itemImage = display.newImage(inventory[t.ID][1]) t. being my target ID. But in order for ...
3
votes
3answers
388 views

Automatically triggering standard spaceship controls to stop its motion

I have been working on a 2D top-down space strategy/shooting game. Right now it is only in the prototyping stage (I have gotten basic movement) but now I am trying to write a function that will stop ...