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

2
votes
0answers
37 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: local B = {} -- in real life there is other stuff in B B.Object = { constructor = function() end, ...
2
votes
1answer
39 views

Generating random strings

I've created the following string manipulation function for randomizing my passed string in Lua: require "string" require "math" math.randomseed( os.time() ) function string.random( self ) ...
6
votes
1answer
163 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 ...
1
vote
0answers
21 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 ...
6
votes
3answers
259 views

Is there a better way of implementing this control structure?

I have the following control structure that I would like to improve: if(number >= 100) then doSetInc(id, 8, 20) elseif(number >= 91) then doSetInc(id, 8, 30) elseif(number >= 81) then ...
3
votes
1answer
91 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: Topic = 0 local messages = { {"name", ...
1
vote
2answers
59 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
120 views

LZW Compression In Lua [closed]

I would like a function for LZW data compression in the Lua programming language. Here is the pseudocode - pattern = get input character while ( not end-of-file ) { K = get input character ...
3
votes
0answers
139 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 ...
1
vote
4answers
62 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 arrays to check and was wondering ...
3
votes
0answers
107 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. ...
3
votes
0answers
407 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 ...