Click here to Skip to main content
15,881,938 members
Everything / Programming Languages / Lua

Lua

Lua

Great Reads

by Andrew Kirillov
An open source application to acquire and process video from cameras
by flyhigh
By implementing a UI library and exporting its necessary components to lua script, we can create a beautiful UI and implement relevant logic in Lua script completely.
by unitpoint
The ObjectScript is a new embedded programing language that mixes benefits of JavaScript, Lua, Ruby, Python and PHP. The ObjectScript has syntax from JavaScript, multiple results from Lua, sugar syntax from Ruby, magic methods from Python and much more.
by Patrick P. Frey
In this article we see how a very primitive compiler is written in Lua using Mewa and how to compile and run a simple demo program in the shell.

Latest Articles

by Stephane Capo
A multi purpose, cross-platform, free and Open Source C++ framework. Lua Binding feature
by flyhigh
By implementing a UI library and exporting its necessary components to lua script, we can create a beautiful UI and implement relevant logic in Lua script completely.
by Patrick P. Frey
In this article we see how a very primitive compiler is written in Lua using Mewa and how to compile and run a simple demo program in the shell.
by Andrew Kirillov
An open source application to acquire and process video from cameras

All Articles

Sort by Score

Lua 

4 Apr 2019 by Andrew Kirillov
An open source application to acquire and process video from cameras
31 Oct 2022 by flyhigh
By implementing a UI library and exporting its necessary components to lua script, we can create a beautiful UI and implement relevant logic in Lua script completely.
25 Mar 2013 by unitpoint
The ObjectScript is a new embedded programing language that mixes benefits of JavaScript, Lua, Ruby, Python and PHP. The ObjectScript has syntax from JavaScript, multiple results from Lua, sugar syntax from Ruby, magic methods from Python and much more.
26 May 2021 by Patrick P. Frey
In this article we see how a very primitive compiler is written in Lua using Mewa and how to compile and run a simple demo program in the shell.
16 Mar 2022 by Dave Kreskowiak
You can find it in the documentation under Section 3 - The Language. Lua 5.4 Reference Manual - Section 3.1 - Lexical Conventions[^] Beyond reading it to you, this is the best answer you're going to get.
2 May 2022 by CPallini
From Lua 5.3 Reference Manual[^]: os.clock () Returns an approximation of the amount in seconds of CPU time used by the program. It doesn't seem to me the most appropriate function for implementing a delay. Try local function wait(seconds) ...
1 Mar 2012 by li9705
This article presents a method which uses CLE middleware to call Lua from a Java application on Android
22 May 2012 by barneyman
Have you tried their site[^]?Or google[^]?
7 Jan 2013 by Sergey Alexandrovich Kryukov
You would better ask the author of this article. Load the article page (follow you own link you provided above), locate the section "Comments and Discussions" and click "Add a Comment or Question" to ask author your questions. The author will receive notification on your post and get a chance to...
10 Sep 2017 by Graeme_Grant
I don't program in LUA, but this Google Search should have something useful for you: lua http request[^] ... solutions like: * LuaSocket: HTTP support[^] * GitHub - daurnimator/lua-http: HTTP Library for Lua. Supports HTTP(S) 1.0, 1.1 and 2.0; client and server.[^] * GitHub -...
7 Nov 2018 by CPallini
You wrote an endless loop (a loop running forever) because the while condition is always true. You may easily check it running the following code: GetServerStats, UserImbalance = "Lua Server Status", "Inbalance Pulsle" print(UserImbalance) FolderImBalanced, NewNilValue = true, false while true...
27 Aug 2020 by CPallini
I would use a table for such a task, e.g. local nameList = {"Maxime", "Ivan", "Ian", "Luna", "Wes"} local var = {} for _, v in pairs(nameList) do var[v .. "_age"] = math.random(1,100) end print(var.Ian_age)
25 Nov 2020 by OriginalGriff
You're running late - the rest of your class was trying to get us to do this homework last week ... But I'll tell you what we told them: Quote: We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it...
13 Jun 2022 by OriginalGriff
Start here: How do events and :Connect work in Roblox Lua? - Scripting Helpers[^]
13 Jan 2023 by CPallini
Yes it is possible to make games with Lua. You may also find several game engines, see, for instance: Lua - Game Programing[^]. Since Lua is a scripting language, I really don't get you on the 'online compiler' part.
12 Sep 2023 by OriginalGriff
We have no idea - remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with - we get no other context for your project. Imagine this: you go for a drive in the country, but you...
31 Jan 2012 by heavendec
Hi,I'm in need for making a table to make some statsitcs.The table is of six colomns but the last column must have many contents of the same category to be processed and the number of contents is variable. Each one of my tables is distinguished by the values of the first and second columns.You...
18 Jun 2012 by exposed12
To enable the data for the angle, you have to write a certain Eventlistener and have to register it with the SensorManager class.public class myAngleClass extends Activity{ public void onCreate(Bundle savedInstanceState) { ...
7 Jan 2013 by exilepilot
Hey, I was following a tutorial on this site. It's called "Integrating Lua into C++", whether it's out-dated or the problem is on my end. Integrating Lua into C++ Here's the errors I'm receiving when I'm compiling:ErrorsAlso, here's the source. It contains two files of...
9 Apr 2013 by tya_tiut2
hello,,, I'm newbie in Lua. Do you have a sample programming of Lua other "hello world". So what I mean particulary to make object 3d like openGL/c++. Thanks,,,
9 Apr 2013 by CPallini
You may have a look at one of the examples[^] of LuaGL.
10 May 2013 by 1Future
Hi, in my game i have created a collision function, in this game multiple eggs fall from the sky and when they collide with the "ground" i want them to disappear .. the problem is that when the first contacts the ground it disappears but the rest of them don't.. can you pls help...
10 May 2013 by R. Giskard Reventlov
You should try asking here[^].
11 May 2013 by 1Future
hii have created game where a user will have to match buttons on the screen. The screen contains 12 buttons on a grid which all work well. My Problem is that i want to change the scene to a scene named "congrats" when the user matches all the buttons . I am currently having difficult with as i...
11 May 2013 by Richard MacCutchan
You are more likely to get good help at http://www.coronalabs.com/products/corona-sdk/[^].
4 Jun 2013 by Damfodeky
Please i have tried several attempts and googled many times but to no benefit.My questions is, how can i make the mouse cursor detect the text under it, and if it is a hyperlink, change into the HAND mouse cursor, using lua programming language. Please, support your suggestion with an example....
21 Jul 2013 by GiZmoDragonBack
Hi,I have to use a script language for an embedded program which is written in C. So far I know that there are several option available such as Python, Ruby, Lua and Java.The software is running under a LEON2 SPARC microcontroller. I am using as a breadboard platform the spacecraft...
23 Jul 2013 by KarstenK
Consider consulting the LEON" SPARC manual or experts. They know better what is useful and stable. The runtime of the language must work on the system.I personally would prefer Python over Ruby, and avoid Java and Lua.
5 Aug 2013 by sean peart
hi i am so stuck right now.i am really mad about this, because i was trying to get scroll view working in Storyboard. I was fool around with a file / sample app in Corona with scroll view and it the scroll view works find because its not following Storyboard. when i go over to my game i worth...
15 Oct 2013 by rohit24c
Hi, i have a c# function .public bool setvar(string varname) { int value = 0; try { if (!string.IsNullOrEmpty(varname)) { return true; } else { return "Error"; ...
26 Dec 2013 by Member 10488466
local io = require("io")local http = require("socket.http")local ltn12 = require("ltn12")print("Search: ")search = io.read()myurl = http.request{url = myurl,sink = ltn12.sink.file(io.stdout)}I was trying to find a definition from Internet. I want to write this project in...
10 Sep 2014 by Digital Resistance
I have an image that is and must have its anchor/origin point set to the upper left corner. It is a large image bigger than the screen and I want the ability to pan across it and zoom into the visible center. By default, the scaling collapses to the upper left as you zoom in. Simply put, I need...
9 Nov 2014 by FoxtrotBravo
I have a very small site that uses HTML and Lua to run some java scripts, the site runs off WSAPI on a Linux machine. Compactness is paramount for this project and I would like to know if I could use AngularJS / Angular light instead of Lua.If this question would be better suited to another...
9 Nov 2014 by Kornfeld Eliyahu Peter
It is almost impossible to tell, as you tell nothing about your design...However Angular is best for single page MVC structured web application - check it against what you have...Only take care of the fact that Angular is just before a major re-design, and future versions will not be...
1 Mar 2015 by xSSel
Im watching a youtube video to learn Lua, what I dont understand is why he used tinput instead of input in the following code:print("Welcome to the game")input = ""inv = {"coin", "sword", "armor"}while imput ~= "exit" do print("What do you want to do?") input = io.read() ...
1 Mar 2015 by CPallini
Is is just another variable (that collects further input from the user via io.read).Please note, the following lineQuote:while imput ~= "exit" dodoesn't look correct ( I suppose the variable name should be input. Is it a typo?).
1 Mar 2015 by xSSel
Still a little bit confused but thanks, I tought it was something else.And yes, its input not imput, my fault!
6 Apr 2015 by Android on Intel
In this tutorial you’ll learn how to create a simple game using the Cocos2d-x framework, version 3.0 or later, in a Windows* development environment and how to compile it to run on Windows and Android*.
20 Jan 2016 by Member 12276450
Got it almost 100% working --for Garry's Mod Private messaging chat command /pm/pm username message-- message hides from everyone else in server except theusername.serverside code - function Drsgrgsgg(pl, text, teamonly)if text:find( "/pm" ) thenfor k,dhdddh in...
1 Aug 2016 by Dave Kreskowiak
Google for "lua tutorial youtube".
3 Sep 2016 by mahou82
here is my code that i steal it ( not i programming ): Imgur: The most awesome images on the Internet[^] . what is all those black word? i though computer can't read it? i think computer just can read : int, elf, if, the, printf, local , function , true , false,... i just beginning at...
3 Sep 2016 by Richard MacCutchan
You cannot learn programming by looking at code on the internet. You need to find some books or study guides. I expect there are many that are written in Korean that will help you.Google translate:당신은 인터넷에서 코드 를보고 프로그래밍을 배울 수 있습니다. 당신은 어떤 책이나 학습 가이드 를 찾을 필요가있다. 나는 당신을 도울 것 한국어 로 작성되어 많은 이...
4 Sep 2016 by Member 12719400
Right I have to admit I'm new to this so here we go;So I am creating a World of Warcraft addon, something I have not attempted before and I am struggling. To start with I am trying to create a frame at the bottom of the screen with an image displayed within it. I am able to create the frame,...
4 Sep 2016 by OriginalGriff
Start with a dedicated site: Google can find you lots.World of Warcraft addon tutorial- Google Search[^] - this is an IT based site, not a games related one, and you need to talk to more "focused" people.This would be a start: AddOn programming tutorial - WoWWiki - Wikia[^] - join the...
10 Sep 2017 by The Chaotic Void
Ex Website: https://www.test.textFile.txt/ How would I get text from this site if the site contained the text: "Hello World" What I have tried: Posting Http Requests to the site to get the text.
10 Sep 2017 by The Chaotic Void
I have a function that splits a string up into a table, but with chars. function strToTable(stringer) local newTable = {} for i = 1, #stringer do newTable[i] = stringer:sub(i, i) end return newTable end and then I have a function that turns the char table into a word table. ...
10 Sep 2017 by Graeme_Grant
I don't program in Lua. However when I get stuck, Google Search is my first go to as I know that I am not the only one who has encountered the problems that I experience. A quick search proves that every time. So, the internet can be a powerful help tool, and your best friend and mentor, when...
30 Sep 2018 by Member 14002954
I would like to change the following in the code, so I would like for the command to be activated upon pressing Left Ctrl button instead of RMB. Can someone please adjust the following code and correct it please ? EnablePrimaryMouseButtonEvents(true); function OnEvent(event, arg) if...
30 Sep 2018 by CPallini
I guess it is the IsModifierPressed("lctrl") call. You have to look up it in the "LUA API reference for LGS scripting", the PDF document installed with LGS.
7 Nov 2018 by Bowser Films
As a new lua programmer i am enjoying learning new things in lua. I am learning from: https://www.tutorialspoint.com/lua/lua_loops.htm However, when i practice my code it wont work. In my code i defined a object called "FolderImBalanced" and make that object to TRUE. Later on in the code i...
28 Jul 2020 by Member 14848624
Hi. I'm making a game on the ROBLOX platform using Lua coding language. I need to make it so that every time the game is loaded, a brick/part is spawned in 1 of 4 locations RANDOMLY. I have a capture the flag game, and there are four castles. I...
28 Jul 2020 by OriginalGriff
Please, read the question, and think about what you are trying to do. You have code to generate a random location: you want code to select one of four locations. So ... modify the random code to generate a number between 1 and 4 (or better, 0...
28 Jul 2020 by CPallini
local tower = math.random(1,4) See Lua 5.3 Reference Manual[^].
20 Aug 2020 by Member 14848624
I'm making a game in Roblox Studio where I need to set up a cut scene. So far, I've worked out the details about how to bring the camera to where I want the scene to occur, however right now, when it activates, the camera "teleport" to where it...
20 Aug 2020 by Dave Kreskowiak
It's very unlikely you're going to get an answer to this here. You would be much better served posting your question in a forum dedicated to Roblox development, like here[^].
29 Jan 2021 by Member 14848624
Hi, I'm building a game using Lua, including the built-in functions Roblox provides. However, this question isn't Roblox specific = I think it can apply to anything using Lua language. However, just be aware that the solution can involve...
21 Aug 2020 by OriginalGriff
The problem is that the execution takes too long, and Roblox assumes that you app has crashed and died - so it kills it for you. Your while loop sits there checking the flag over and over and doing nothing else, so the assumptuion is it's never...
27 Aug 2020 by Member 14848624
Let's say I have a loop that is creating variables for every element in a list, with the script like this: local nameList = {"Maxime", "Ivan", "Ian", "Luna", "Wes"} for _, i, in nameList do [insert script here] end What I have tried: In...
27 Aug 2020 by Dave Kreskowiak
No, you can't. This is what arrays are for.
29 Aug 2020 by Member 14848624
Is it possible for me to access Place 2 if I have a localscript in Place 1? If I wanted to access anything in the workspace, I would do workspace.object. But what if I wanted something in the game, but is a different place? (Place as in: Game...
29 Aug 2020 by Sandeep Mewara
This is too specific to some thrid party which AFAIk is not very known. Would suggest you to use their community/forum to post specific queries to get faster and more appropriate response: Roblox Developer Forum[^] A similar discussion if it...
25 Nov 2020 by Patrice T
Posting your homework is not a question. You show no attempt to solve the problem yourself, you have no question, your main effort is pasting the requirement, you just want us to do your HomeWork. HomeWork problems are simplified versions of the...
22 May 2021 by scriptingnoob
Hello Everyone I am trying to make the lights on a police car keep flashing, but the while loop I am using does not work. The Output shows that the wait loops does not function, and I have used print statements to see where the issue was. Please...
22 May 2021 by Richard MacCutchan
See wait function lua Code Example[^].
25 Feb 2022 by CPallini
Lua has no way to wait function because (I suppose) it is a OS dependent feature. You may rather easily implement it wrapping the one your OS provides (e.g. usleep on Linux or Sleep on Windows), see Programming in Lua : 26[^].
7 May 2022 by Anthony Durk
Hello i got an issue where i'm trying to make a wait function in lua but it's erroring does anyone know why and how to fix this issue thankyou to those who helped :) -- Function for Vanila Lua local function sleep(seconds) local...
2 May 2022 by OriginalGriff
Look at your code: you do not give a value to the variable seconds when you pass it to your function. Try this: local function sleep(seconds) local waittime = os.clock() + seconds/10 repeat until os.clock() > waittime return seconds end ...
3 May 2022 by Richard MacCutchan
Try the Lua documentation, or lua nested functions - Google Search[^].
7 May 2022 by Patrice T
You method of waiting is a bad idea. -- Function for Vanila Lua local function sleep(seconds) local waittime = os.clock() + seconds/10 repeat until os.clock() > waittime return seconds end This code is waiting from the user point of...
13 Jun 2022 by Member 15671652
i am learning lua as python do be bad i need some info on local functions and running:Connect(function), pls What I have tried: knowledge from python and the ide
10 Dec 2022 by Rkut
I have a txt file with numbers in this pattern: 3 2 1 3 4 5 9 4 2 3 4 2 2 3 4 5 I have to read this data and convert it into a suitable data structure. This all needs to be done in Lua and I am quite brand new to the language. Please assist? ...
9 Dec 2022 by Richard MacCutchan
If you are brand new to a language then the best place to start is at the language home page: The Programming Language Lua[^].
10 Dec 2022 by CPallini
Try local f = io.open("grid.txt") assert(f, "unable to open the file") -- collect the array local arr = {} for l in f:lines() do local row = {} for snum in l:gmatch("(%d+)") do table.insert(row, tonumber(snum)) end table.insert(arr,...
13 Jan 2023 by Richard MacCutchan
Sorry, this site does not provide code to order. Try freelancer.com.
28 Feb 2023 by Vancho-12345
I have a request body that contains some numbers in JSON format. I need to forward that number to a specific host. For example, I have 4 .csv files locally and I need just search if it's containing that number. CSV files should compare the...
14 Sep 2023 by OriginalGriff
This is the same question you asked two days ago: How can a building be raised by one meter in roblox studio when we have enough money?[^] - the answer hasn't changed since then:Previous Answer: We have no idea - remember that we can't see your...
18 Sep 2023 by Richard MacCutchan
You would probably get better help at the Roblox website. This forum is for actual programming questions.
18 Sep 2023 by OriginalGriff
Seriously, you need to go to the Roblox site, or a site dedicated to Roblox gaming - this is the wrong site; we aren't here to hold your hand and do all the work for you, and both your questions require that. We are here to help people learn,...
6 Feb 2014 by CPallini
A simple algorithm for counting occurrences of symbols in files
3 Mar 2014 by CPallini
Simple approach to heap data structure and heapsort, using C and Lua
26 Oct 2018 by José Cintra
Simple algorithm to determine the type of a triangle, being informed its sides
4 Aug 2013 by Richard Chambers
Using a subset of the available Lua 5.2 C interface to extend a C++ application with Lua.
16 Mar 2022 by Richard MacCutchan
Read the official documentation: The Programming Language Lua[^]
16 Mar 2022 by CPallini
[update] (Thanks to Maciej Los) See the index section of the reference manual, e.g. Lua 5.4 Reference Manual - contents[^] section 3.1 ofLua 5.4 Reference Manual[^]. [/update]
9 Oct 2012 by unitpoint
The ObjectScript is a new programing language that mixes benefits of JavaScript, Lua, and PHP. The ObjectScript has syntax from JavaScript, multiple results from Lua, OOP from PHP and much more.
12 Nov 2016 by Zebedee Mason
Perform dependency analysis by using Doxygen to parse source code and produce a report
17 Jun 2012 by satrio_budidharmawan
Hi guys,I need something from your brain and mind d^_^b.Here's the issue :I need to know how do android device managing it's orientation? I mean, how do I know it will get Landscape or Portrait or else (on what degree of obliquity).I got these code : float angle =...
9 Nov 2018 by Сергей Челноков
22 May 2012 by satrio_budidharmawan
Hi, Everybody might be heard about LUA and keeping an understanding and some idea within it.But, I don't get it rightly.Why we use LUA in our codes?All I know in LUA is :Lua is a powerful light-weight, small footprint programming language designed for extending applications. Along...
13 Nov 2018 by Vlad Neculai Vizitiu
Getting closure on Closures
1 Mar 2023 by Stephane Capo
A multi purpose, cross-platform, free and Open Source C++ framework. Lua Binding feature
13 Oct 2013 by JtsTiny
hi , first thank for you read my question! i want to known hao to convert a lua script to bytecode? i don't care any concept about lua.please give me code in c++ directly!thank you very much!
13 Jan 2023 by Bryant Reyes
i need to just know if it is possible ornot who knows but if it is some one give me the code just for that simple game pls and it has to be in lua pls. What I have tried: ive tryed it but i just still a nub with lua so if someone could make a...
18 Sep 2023 by Osman Çiftçi
do you have any suggestions on how to make a zombie in roblox stdio that is aggressive and damages our health when it hits What I have tried: I can't, so I wanted your opinion.
20 Jan 2016 by Member 12276450
What I got so far is not much I have been struggling to find the answer.I need it to allow private messages by typing /pm username messagefunction Drsgrgsg(pl, text, teamonly)if text:find( "/pm" ) thenfor k,dhdddh in pairs(player.GetAll()) doif string.sub( text, 5 , 13 ) ==...
10 Sep 2017 by The Chaotic Void
Welp Exploit Kids here. Anyways Here are the few things I need you to describe: [-] What is the class of the object your trying to execute. [-] Have you used RemoteSpy?
6 May 2013 by ballwql123
Hi, Anybody who use the "2d lua based robot simulator", it's from [auralius manurung]. Some errors happened when I run this project, details are as follows: 1.The world file can't work in Win7,( It's ok in winxp). 2.When I load lua file in Code Editor and run this project,Callback...
6 May 2013 by ballwql123
Problem has been solved, tks for everyone!