Questions tagged as 'lua'

1
answer

Pass this Numeric function from Virgula to Point

I have a function that returns the number in the thousands, eg: function getMilharNumber(n) -- critico return tostring(math.floor(n)):reverse():gsub("(%d%d%d)","%1,"):gsub(",(%-?)$","%1"):reverse() end print(getMilharNumber(1000000)) -- re...
asked by 04.06.2015 / 16:06
1
answer

How to take time per millisecond?

I would like to take the time (HH: MM: SS) per millisecond. Ex: 86400000 It would be: 24:00:00 since it is the equivalent of one day.     
asked by 06.10.2014 / 16:18
1
answer

Check if a value corresponds to a value in an array

How to check if a given value corresponds to another in an array? Ex: array1 ={nome = "Fulano", idade = 15} print(array1[idade].nome)     
asked by 27.07.2014 / 11:26
1
answer

Function that receives another function as a parameter in C #

In the Lua language you can create a function that receives another function as an argument, for example: exemplo = function(outrafunction) outrafunction() end exemplo(function print("alguma coisa") end) Is there any way to do this using...
asked by 07.08.2018 / 06:46
2
answers

Get the highest value of an array in Lua

I am using Lua code and want to get the largest value of an array. Example: tem_array = {10,2,3,20,1} I used this code below, but I get the number of elements and not the maximum: max = math.max(unpack(tem_array))     
asked by 05.02.2015 / 16:12
1
answer

How to bind a variable from a class in c ++ to lua script?

How do I access and set a variable from a class made in C ++ to Lua? // C++ #ifndef SCRIPTSTORAGE_H #define SCRIPTSTORAGE_H #include "HTest.h" #include <luajit/lua.hpp> #include <iostream> struct HObject { unsigned int id;...
asked by 29.03.2014 / 18:54
1
answer

Is it possible to detect the key pressed in Lua?

Working in terminal mode, I have control over the screen coordinates where the text will be displayed, however I need to detect if a key has been pressed , without it echoing > on the screen. Is there a function or library that allows me t...
asked by 29.10.2014 / 02:57
1
answer

Create reading of a moon bool function

Well I'm learning the moon and I'm having a question, I'm trying to create the reading of a bool function on the moon. I have a function that disables or activates as I mark true or false. This function is called useappenabled , but...
asked by 05.10.2015 / 21:33
1
answer

"require" in higher directories

I have a program in Lua. This is the structure of the files: |Programa |-Main.lua |-config.lua |--------functions |-functions.lua Through functions.lua , I want to give require to config.lua . Is there a...
asked by 20.11.2014 / 19:11
1
answer

How exactly does the Lua canvas.compose () work?

   canvas: compose (x, y, canvas_src)       Make the composition pixel by pixel between two canvases.       The canvas passed as src 'is drawn on the canvas in use (canvas)   in the past position.       Receives:       x: [number] Positio...
asked by 21.01.2016 / 14:19