Lua is a powerful, fast, lightweight, embeddable scripting language. Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual ...

learn more… | top users | synonyms

5
votes
2answers
48 views

Lua Formula Code

A friend of mine dabbles in lua, and he recently sent me a code which applies an equation we were discussing. I personally am very mediocre with lua, but my Python senses are tingling - I feel as ...
5
votes
2answers
343 views

Performing non-production analytics on data

I have the following Lua script which I use against my redis environment to perform some non-production analytics on my data. My dataset contains hundreds of millions of records, hence I want to make ...
5
votes
0answers
39 views

Garrys Mod custom spectate player

Been making my own scoreboard and needed a custom spectate function for it so I made this: ...
5
votes
0answers
60 views

Runtime expression autocompletion

I've written a function that can be used at runtime to suggest how the provided incomplete Lua expression can be completed so that it would make sense (that is, it would evaluate to a non-nil value). ...
2
votes
0answers
52 views

Can this “syntax sweetener” be improved?

I have a Lua project that uses some syntax sugar described in DecoratorsAndDocstrings, near the bottom of the page. It looks like this: ...
4
votes
0answers
56 views

Copying folder contents from several folders

I have a file directory which contains folders for every month, and within those folders are several text files. In this context I would like to copy all of the text files from my ...
1
vote
1answer
59 views

Calculating the Hamming distance

That's an easy one. I just want to calculate the Hamming distance between two strings. ...
4
votes
0answers
168 views

Redis rate limiting in lua

I've implemented a rate limiter for redis in lua, and I'm wondering if anyone has any suggestions that might improve the performance. An example use: ...
3
votes
0answers
126 views

Translating a JavaScript prayer times calculator into Lua [closed]

The JavaScript file that I'm trying to translate into Lua is found here: The above code has been translated by contributors to the following languages (refer to here): Python PHP Java C++ ...
4
votes
2answers
241 views

Lua string parsing

The following code takes a string and converts it to it's number equivalent. A=1 ... Z=26, while keeping all other characters intact. It formats the string using two delimiters. One for between ...
0
votes
0answers
98 views

How can I improve this elevator code I made for a game called ROBLOX?

Are there any ways I could improve speed and less code? The elevator that uses this script works fine. Could anything be better? ...
3
votes
0answers
69 views

My First Lua Code

This Lua code runs in redis. It iterates over some JSON docs, and applies some logic based on the user (if any) making the request. I'm sure there's a lot I can improve here. ...
5
votes
1answer
111 views

C++: Generating similar methods with macros

I am currently working on a project that involves Lua. For convenience, I created a wrapper class for the Lua state structure. However, I also added some methods for getting globals and table fields. ...
7
votes
0answers
149 views

Lua OOP and classically-styled prototypal inheritance

I want to do some object-oriented programming in Lua, and I decided on something like this: ...
3
votes
1answer
150 views

Generating random strings

I've created the following string manipulation function for randomizing my passed string in Lua: ...
7
votes
1answer
252 views

Is this bad OOP design?

I've discovered (and written) a way to object oriented programming in lua in a functional fashion instead of the standard metatable method. It carries much more functionality (no pun intended) but I'm ...
2
votes
0answers
36 views

How can i make this code more robust, fail proof?

I have some code that needs to update 2 separate databases with user credentials. The first database, I just use standard sql to do it. The second database, I have to use command line scripts to ...
7
votes
3answers
280 views

Is there a better way of implementing this control structure?

I have the following control structure that I would like to improve: ...
3
votes
1answer
111 views

Help me improve my script

Was the best way to implent this? For example it will only say "It's nice I know." If you first ask "hat" and then answer "yes". This is how I'm thinking: ...
0
votes
2answers
75 views

Lua aray problem [closed]

I'm working on a game but Im havin a bit of a problem. The problem is for example if i buy 1 ham it charges 55 gold and I get 1 ham but if I want 5 ham I get 5 ham but it only charge 55 gold when it ...
2
votes
2answers
196 views

LZW Compression In Lua [closed]

I would like a function for LZW data compression in the Lua programming language. Here is the pseudocode - ...
5
votes
0answers
215 views

luaproxy, (semi) automatic exportation of C++ classes to Lua

I'm writing a library that would ease the exportation of C++ classes (that is the definition of their members) to Lua. It originated from the need of tidying up the code for a server mod of a open ...
2
votes
4answers
70 views

Consolidating array accesses

Is there a better or easier way of doing this? if array[1] and array[2] and array[3] and array[4] and array[5] == false then --somthing end I have a lot of ...
10
votes
1answer
161 views

Is this a BSP tree? Am I missing something?

I've been practicing using BSP trees as I hear they are a good start to create procedural spaces such as houses. For ease-of-deployment purposes, I've tested this code in Lua and it seems to work. ...
5
votes
0answers
544 views

Feedback on a C++ API for interfacing with Lua

I wanted a good way to move objects back and forth between Lua and C++, and I didn't want to use anything like LuaBind or the other available libraries I could find, so I instead wrote this. It's ...