Questions tagged as 'lua'

1
answer

Array / Lua table for JavaScript

I have an array in the Lua language, and wanted to pass its elements to an array JavaScript. Example of array Moon: tabela_y = {0, 1, 2} In PHP there is the implode, I do not know if it is possible in Lua.     
asked by 18.03.2015 / 16:27
1
answer

Check if String contains commas

local t = "Hello, World" local v = "Hello World" I would like to know how to check if a string contains commas ...     
asked by 21.06.2015 / 15:48
1
answer

Download with Sockets

I'm using LuaSocket and wanted to download files with it, but I do not know like, I was able to download text file like this: local file = io.open("Blabla.txt", "w") file:write(tostring(http.request("Http://pokestage.ddns.net/patch/News.txt"...
asked by 31.10.2014 / 23:47
1
answer

How to control screen coordinates?

I need to develop a Lua program (desktop application) that manipulates screen coordinates, it does not have to be a graphical environment (GUI), but I need to be able to, for example, position in the coordinate (10, 10) - line 10 , column 10, an...
asked by 02.07.2014 / 04:01
1
answer

How to tell if a given value is inside a specified table

I want to identify if a name is within a list. lista = {"name","name2","name3"} In python I could do if name in lista: , but in moon is otherwise, which I do not know how it is.     
asked by 23.08.2018 / 03:54
1
answer

How to read a file with a 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 Lua .     
asked by 10.12.2015 / 13:31
1
answer

attempt to index local 'rkgdat' (a nil value)

Personal speech, I'm trying to write some information in a .json but I'm getting this error: data.lua: 12: attempt to index local 'rkgdat' (a nil value) local triggers = { '' } local action = function(msg) local rkgdat = load_data('data...
asked by 12.10.2016 / 18:41
1
answer

Is there any way to modify what the module will return in Lua?

I want to know if it exists since I have a data storage system, in which the data is in a table and when the player enters, that data is stored in a module script (The only one that returns something) . The problem is that you can not keep typin...
asked by 14.04.2017 / 01:08
1
answer

Can anyone explain to me what is a generic loop in Lua?

I already know the while , repeat and for ties, but when I was looking at the types of loops, in the section I found the "Loop for generic" section. The text was in English.     
asked by 19.04.2017 / 18:57
1
answer

64-bit band operation

I know that in Moon 5.3 ( demo ) there are 64-bit bit operators, like: print(0xaaDbc4Cd17Af & 0xff00000000) --> DB 00 00 00 00 Is there any algorithm to perform a similar operation on other versions? The Moon I run comes with the...
asked by 29.04.2017 / 20:28