Questions tagged as 'lua'

2
answers

How do I leave some invisible image on love2d?

How do I set the visibility of some image in Love2d? Like for example, let it 10%, 25% or 50% visible.     
asked by 05.01.2017 / 00:26
1
answer

Loop with array + string

I'm trying to do something like: a = {move1="oi", move2="oi2"} for x=1, #a do print(a.move..x) end I can not explain very well, but what I'm trying to do is this: print(a.move..x) getting print(a.move1) and next print(a.move2...
asked by 02.11.2014 / 02:20
1
answer

Insert in an array between certain values

I have two values in the time format, 20:03:02 and 20:03:35 , which are in a array in Lua. hora_array={"20:03:02", "20:03:35"} The difference between the two values is 33 seconds (20:03:02 - 20:03:35 = 33). I want to inser...
asked by 06.02.2015 / 23:23
1
answer

How to use a Lua variable in C ++?

I can not get value from an array in Lua to use in C ++. So I get the value of the variable M : //No LUA M = 85 //No C++ L = lua_open(); luaL_loadfile(L, "teste.lua"); lua_pcall(L, 0, 0, 0); int m; lua_getglobal(L, "M");...
asked by 14.08.2014 / 01:52
2
answers

Difference between ":" and "." in methods of a Lua table

I came across two different statements that left me confused. obj = {} function obj.Create(name) end function obj:GoGoGo(name) end What is the difference of the function declared with the . (dot) and : (colon)?     
asked by 08.12.2015 / 18:46
1
answer

Check values in txt

Well, I want to save a value in a txt file, checking if there is already any value with 2 things equal. Ex: local file = io.open("arquivo.txt", "a+") local oi = {dia=os.date(), numero=math.random(1,10)} if not () then -- Aqui não sei o que faz...
asked by 22.08.2014 / 22:08
2
answers

How does the declaration instance of Table in Lua work?

In object orientation, you usually create the class first and then instantiate it. PHP example: class Test{ public function __construct() { // inicia as parada aqui } } $test = new Test; But in Lua it always s...
asked by 11.12.2015 / 15:34
3
answers

How to format numbers in Lua?

I would like to know how to format the variable: local n = 100000000 To return like this: 100.000.000 Separated by dots, does anyone know how to do it?     
asked by 04.06.2015 / 04:46
1
answer

Unexpected result in Lua test code

I wrote a short code to test a statement from the book I'm studying through, Programming in Lua (3rd Edition). The statement on page 10 of the translated text is as follows: Conditional tests (for example, conditions in control structures) con...
asked by 04.04.2015 / 00:30
1
answer

How to "call" a function from a Lua table in C ++

I'm trying to "call" a function from a table written in Lua . The problem is that I am not able to pass three arguments to this function. When I pass the arguments, it is as if the Lua skips the first argument and continue...
asked by 26.08.2014 / 20:20