Questions tagged as 'lua'

1
answer

How to read JSON with moon?

I would like to know how to read this JSON below through the Lua language. json = '{"nome" : "Wallace de Souza"}'     
asked by 10.12.2015 / 13:24
1
answer

How do you find the smallest value of a moon matrix?

I made this code that makes an Array (At least I think it's doing) and then writes all the values in it. obs: Values are random. I need to find the lowest value in the array, but the logic I've always used gives me a predictable result. Exam...
asked by 04.07.2016 / 04:44
1
answer

Call C ++ from Lua

I would like to know if there is a way to do a moon extension with a C ++ library, that is, the moon script accessing functions in C ++. Ex: add.lua file -- add two numbers function add ( x, y ) CHAMAR AQUI uma função de uma bibliotec...
asked by 15.07.2015 / 21:00
1
answer

SrLua - Problem after compiling

I'm trying to compile a simple script that contains: require 'classlib' human = class() function human:__init(name) self.name = name end gabriel = human("Gabriel") print(gabriel.name) With srlua, but after compiling, when I try to run,...
asked by 28.12.2014 / 15:38
2
answers

How to manipulate UTF-8 on the Moon

How to work with a composite UTF-8 encoded string on the Moon? As for example: get one-character code in a string by its index; encode character codes, something like string.char(...códigos) or ('').char . What are the p...
asked by 26.01.2017 / 23:54
2
answers

Erase repeated values

How could I do to delete repeated values in a table? Ex: a = {1,2,3,4,3,2,1} How would you erase 3, 2, and 1, keeping only one of each? My table is one inside another: a = { {a=1, b=2}, {a=2, b=3}, {a=1, b=2}, } In this case, the la...
asked by 30.10.2014 / 17:06
2
answers

Which Development Environments (IDE) for Android and IOS using Lua?

I want to know what Development Environment options to develop applications for Android and IOS using the Lua language.     
asked by 14.07.2017 / 21:35
1
answer

In Pairs or Ipairs

Are there any differences between in ipairs and in pairs ? What? a = {1, "b", 3, "d"} for i, v in pairs(a) do print(i, v) end print("Ipairs") for i, v in ipairs(a) do print(i, v) end Return: 1 1 2 b 3 3 4 d Ipairs 1...
asked by 03.11.2014 / 04:16
3
answers

Is there any way to get a particular row in a string?

I have this example string: s = [[Pão com Requeijão]] Is there any way to get only the second line of the string? If so, how?     
asked by 03.01.2018 / 20:28
1
answer

Find the angle between 2 vectors in 3d

I want the angles X Y Z between the 2 vectors To make a line between them. math.atan2(t2.y - t1.y, t2.x - t1.x) * 180 / math.pi)-90 This was the account I used to discover Z, but the others I can not do, the X and Y. The size is C.S...
asked by 21.12.2016 / 14:37