Most voted "lua" questions
Lua is a fast and lightweight scripting language designed to extend applications. It is typed dynamically, interpreted from bytecodes, and has automatic memory management with incremental garbage collection. Its features make Lua an ideal language for configuration, automation and rapid prototyping. (visit lua.org).
Learn more…203 questions
Sort by count of
-
2
votes2
answers75
viewsHow do I remove the thousandths of a value?
For example number=10.123456 how do I remove the thousandths of number so that it stays just 10.12?Help me please
luaasked 7 years, 11 months ago arthurgps2 411 -
2
votes2
answers175
viewsWhat is the difference between local`Function var` and local`var = Function...`?
There are two ways to declare a local function directly. local var = function() end; and local function var() end What’s the difference between them?…
-
2
votes1
answer166
viewsConvert String to Tables
local items = {} local t = "7 2182, 4 2554, 5 9908" I wanted to convert using this string and let the table come out like this: local items = {{7,2182},{4,2554},{5,9908}} is there any way? using…
-
2
votes2
answers963
viewsIs there a way to use accents in strings in LUA?
I’m looking for a way to use string accents in the LUA language. I’ve tried this texto='Pão,está,cabeçalho,' Because in the engine I am using (ROBLOX studio), the game only writes until the stretch…
-
2
votes4
answers5462
viewshow to insert picture into database
What type of variable do I use to store an image in the database? And is there a specific command for this? or just enter as any record? i have a project in the moon language ( mobile by Corona sdk…
-
2
votes1
answer295
viewsAccess sub-tables in a moon table
How do I read a subtable inside a table? I tried to return the value with the following function but it went wrong. name = {"Lowes", "Renata", "Titia", "Maria"} health = {} posx = {} posy = {} posz…
-
2
votes0
answers46
viewsLiteral strings Corona Moon
I’m a little lost in the use of \t. On the console, it works and in the simulator it is ignored. If anyone knows of a possible solution. local myText = display.newText("a\tb", 200, 100,…
-
2
votes1
answer58
viewsGravity with "Physics" Corona SKD library (ERROR)
I am solving a college exercise in Orona SDK in the realization of a small game, but I have a small problem in the hour when the ball will fall from "top" for the second time. The point is that I…
-
2
votes2
answers125
viewsHow to know if a certain value is within a specific table
I want to identify if a name is inside a list. lista = {"name","name2","name3"} *In python I could do if name in lista:, but in moon It’s another way, which I don’t know.…
luaasked 6 years, 3 months ago Novohp 801 21 -
2
votes1
answer74
viewsHow do I do an event on the moon?
i want to know how to make an event, for example with the do to see if the user typed 'q' or 'o', as if it were in a addEventListener()
-
2
votes1
answer45
viewsGet function information in Lua
How could I have information about global functions in a file. moon? function showAll(arg1, arg2) return print(arg1, arg2) end Type, have information on arguments, etc.…
luaasked 4 years, 6 months ago KronoS Lettify 21 -
2
votes2
answers437
viewsHow to clear what has already been written on the moon terminal?
After the execution of the command: Print("teste") Info = io.read() I would like the terminal screen, with the print resulting were cleaned
luaasked 4 years, 3 months ago Daniel Verlierer 21 -
2
votes1
answer62
viewsHow to replace a special character in moon?
I’m developing a hangman’s game, but I found a problem, I can’t replace the character ã. Follows the code: local done = false local words = { "bola", "casa", "avião" } local randomWord =…
-
2
votes1
answer76
viewsI can’t import tables with require
I’m learning the Moon programming, and I’m learning the Require. But when I try to import a table or anything else a mistake happens. What I’m trying to do is export a table with a function. What I…
-
2
votes1
answer74
viewsWritten to command line via Lua, command line reading via C#
I was in need of some help with a code on moon, to generate parameters for the command line, and then collect them by another application, only in C#, to be more specific, I want to run a virtual…
-
1
votes1
answer96
viewsAuto benchmarking with moon
A script in C or C++ could write algorithms in Lua (by Brut force, that is, test several possible combinations) based on a database with the results of the algorithms. The idea is to get to the most…
-
1
votes1
answer170
viewsHow to control screen coordinates?
i need to develop a program in Lua (desktop application) that manipulates screen coordinates, does not need to be a graphical environment (GUI), but need to be able to, for example, position in the…
-
1
votes2
answers148
viewsString "letter" position
How can I get the position of a letter in a string. EX: a = "x x x" I’d like to take the position of each x. I tried using the string.find, but he just took the one from the first one.…
luaasked 10 years, 1 month ago Gabriel Sales 1,257 -
1
votes1
answer154
viewsDownload with Sockets
I’m using the Luasocket and wanted to download files with it, but I don’t know how, I managed to download text file like this: local file = io.open("Blabla.txt", "w")…
-
1
votes2
answers109
viewsDo not execute command line
Well, I’m doing a show with Vclua and I realized that after compiling, even with the graphical interface, it runs the command line mode, how do I avoid that? Running only the program. I compiled it…
luaasked 10 years, 1 month ago Gabriel Sales 1,257 -
1
votes1
answer94
viewsGet "output" from Lua command
I want to take Output from a moon command and store it in a string. EX: print(1) output->1 getOutput("print(1)") I would like to store the returned value in a string, in this case, 1. Something…
luaasked 10 years ago Gabriel Sales 1,257 -
1
votes1
answer133
viewsPick Table in string form
I’m trying to get a string table. EX: tabela = {1, b=2, {c=3}} print(getTableString(tabela)) If this function existed, and functioned, it would return: -> tabela = {1, b=2, {c=3}} Is there any…
-
1
votes0
answers62
viewsHow to set a background image in a Wxframe?
With the library wxLua, how do I use an image as a background WxFrame? Using the wxBitmap, the components on the image are not shown correctly.…
-
1
votes1
answer87
viewsIuplua - Background dialog
How do I define an image as the background of a Dialog? In the documentation it says: BACKGROUND (non inheritable): Dialog background color or image. Can be a non inheritable Alternative to BGCOLOR…
-
1
votes1
answer1225
views -
1
votes1
answer41
viewsLuasql(Sqlite3) accepting only a "value"
I’m trying to create a simple table, just with names, but when I enter a value, I can’t enter any more. Like I’m doing: require 'luasql.sqlite3' local env = luasql.sqlite3() local con =…
-
1
votes1
answer191
viewsLua array/table for Javascript
I have a array in the language Lua, and wanted to pass its elements to a array Javascript. Example of array Moon: tabela_y = {0, 1, 2} In PHP there is implode, I do not know if it is possible in…
-
1
votes1
answer174
viewsHow to read a moon table in C as follows
Well I’m trying to create a moon reading that can read this table below, the table should only accept values and if add string, it warns the error location. Table = { 1000, 2000, 3000, 4000, 5000,…
luaasked 9 years, 8 months ago carolzinha 171 -
1
votes1
answer237
viewsUse string and integer in moon
Well I have a table as follows: { Number: 15007 Name: "Variance" Value: 35 } Before I used a txt format that was like this: 15007,Variance,35 The C-code looked something like this: void…
luaasked 9 years, 8 months ago carolzinha 171 -
1
votes1
answer933
viewsHow to convert a string to a number in Lua?
In Lua, how to convert a string type value to the number type (integer, float etc.)?
-
1
votes1
answer79
viewsHelp to save a table
How to save a table to a storage or string, and how I would return it?
luaasked 9 years, 7 months ago Joao Gabriel 43 -
1
votes1
answer119
viewsPHP strips in LUA
I want to convert this PHP code into LUA language. The problem is that there is no function stripos which counts the first occurrence of the desired word in LUA. How can I convert the code below?…
-
1
votes1
answer134
viewsTimestamp without using.time()
How to convert a date and time in your timestamp, but without using the os.time() in Lua? What is the expression to calculate? Is it possible? Example: data = "01/01/2015" hora = "10:00:00"…
-
1
votes1
answer90
viewsGet table inside table Lua through C++
I have a moon file with the following contents: Pokes_Icons = { ["Bulbasaur"] = { on = 12906, off = 12908, used = 12907, } } I am trying to get the value of "on" in C++, I tried as follows: enum…
-
1
votes1
answer254
viewsCheck if String contains commas
local t = "Hello, World" local v = "Hello World" I wonder how to check if a string contains commas...
-
1
votes0
answers88
viewsCreate PDF with 2 pages
I’m using this example: forums.mediabox.fr/wiki/tutoriaux/pao/construction_fichier_pdf to create a pdf header. The problem is that in my example I can only create a page, but I want 2 pages. I use…
-
1
votes1
answer254
viewsDynamic allocation and pointers in Lua
I would like to know how I make dynamic allocation and pointer of a structure in Lua, I have the following instruction in C that I need to pass to Lua; typedef struct ilha { char name; struct ilha…
-
1
votes1
answer872
viewsHow to read a file with moon?
What function do I use to read data from a file in Lua? For example: lua_folder/ .... config.json .... main.lua I want to open this file config.json through the Lua.…
luaasked 8 years, 11 months ago Wallace Maxters 102,340 -
1
votes2
answers212
viewsHow to escape special characters?
I need the output to be a special character of an arrow pointing to the right ( ) for example, whose Unicode code is U+1F812. I tried to write in various ways always with the \ or % preceding…
luaasked 8 years, 7 months ago Daniela Morais 4,687 -
1
votes0
answers37
viewsHow do I put this question to work in the Lua language?
function potencia (x,y) if y==0 then return 1 else return (x*potencia(x,y-1)) end algoritmoPerf = io.write("probabilidade de que cada algoritmo apresente perfeito funcionamento: ") naoperf = 1 -…
luaasked 8 years, 6 months ago Alana Éulem 11 -
1
votes1
answer153
viewsPass C struct to lua script
When I got past my frame Book to the script in Moon, the method writes the value as nil. How I pass the structure Book to my moon code? main. c: #include <lua.h> #include <lualib.h>…
-
1
votes1
answer225
viewsHow do I get a value in Lua without using io.read()?
Let’s say I have something like a = io.read() a = tonumber(a) if a then print(a,a^2-1) end There’s another way to get in this driveway other than the io.read()?…
-
1
votes2
answers124
viewshow do I make a table go showing tables
wanted to do a function that makes kind of something like the thing below for i in pairs(v) do if type(v[i])=="table" then for j in pairs(v[i]) do if type(v[i][j])=="table" then print("...") else…
-
1
votes2
answers1178
viewsDecrypt a code (as I understand it is in ASCII)
Well, basically I’d like to know if there’s any way to turn a script written in ASCII into Characters and if there is, how would I turn it? Code (1) local code =…
-
1
votes1
answer163
viewsKeep connection active after a POST request
I am trying to create a script to activate the QOS bandwidth control service of my router, but I am doing something wrong because I can’t keep the connection after making a POST request. local host…
-
1
votes1
answer234
viewsAttempt to index local 'rkgdat' (a nil value)
Talk guys, I’m trying to record some information on a . json but I’m getting this error: date.lua:12: Attempt to index local 'rkgdat' (a nil value) local triggers = { '' } local action =…
-
1
votes1
answer70
viewsFactor numbers from 1 to 9, accumulating variable printing wrong number
Why my accumulator variable does not print 6? acum=1 n1=6 for i=1,2,3 do if n1%2==0 then acum=acum*2 n1=n1/2 elseif n1%3==0 then acum=acum*3 n1=n1/3 elseif n1%5==0 then acum=acum*5 n1=n1/5 elseif…
luaasked 8 years ago Eduardo D. Oliveira 67 -
1
votes1
answer166
viewsSymbol ; on the Moon
How the symbol works ; on the moon? ;;;; ; ; do ; end; do ;end do ;end; do;end; ;do end ;do end; ;do ; end; ;;do ; end do end
-
1
votes0
answers96
viewsDoubt with Notepad++
How do I make Notepad++ for example: function test() var=true end instead of function test() var=true end sorry I don’t know what to call this action,but whenever I start a function or something…
-
1
votes1
answer226
viewsHas moon language Api for Python
I have heard that there are moon language Ipps to be used in conjunction with other languages like C, c++, c#, there is such an api for Python?