lua

Developing addins for World of Warcraft - Getting started?

As a long time World of Warcraft player, and a passionate developer I have decided that I would like to combine the two and set about developing some addins. Not only to improve my gameplay experience but as a great opportunity to learn something new. Does anyone have any advice on how to go about starting out? Is there an IDE one can us...

Why is Lua considered a game language?

Why is Lua considered a game language? I have been learning about Lua in the past month and I'm absolutely in love with the language, but all I see around that is built with Lua are games. I mean, the syntax is very simple, there is no fuss, no special meaning characters that makes code look like regular expressions, has all the good th...

Is there a way to use Lua on BREW 3.0 platform?

It looks like BREW 4.0 will have Lua included. But is it possible to use Lua on older BREW 3.0 (or even BREW 2.0)? ...

Game Engine Scripting Languages

I am trying to build out a useful 3d game engine out of the Ogre3d rendering engine for mocking up some of the ideas i have come up with and have come to a bit of a crossroads. There are a number of scripting languages that are available and i was wondering if there were one or two that were vetted and had a proper following. LUA and S...

Lua Patterns,Tips and Tricks

This is a Tips & Tricks question with the purpose of letting people accumulate their patterns, tips and tricks for Lua. Lua is a great scripting language, however there is a lack of documented patterns, and I'm sure everyone has their favorites, so newcomers and people wondering if they should use it or not can actually appreciate the ...

How do you glue Lua to C++ code?

Do you use Luabind, toLua++, or some other library (if so, which one) or none at all? For each approach, what are the pro's and con's? ...

How do you pre-size an array in Lua?

I've got a Lua program that seems to be slower than it ought to be. I suspect the issue is that I'm adding values to an associative array one at a time and the table has to allocate new memory each time. There did seem to be a table.setn function, but it fails under Lua 5.1.3: stdin:1: 'setn' is obsolete stack traceback: [C]...

How do I write a generic memoize function?

I'm writing a function to find triangle numbers and the natural way to write it is recursively: function triangle (x) if x == 0 then return 0 end return x+triangle(x-1) end But attempting to calculate the first 100,000 triangle numbers fails with a stack overflow after a while. This is an ideal function to memoize, but I want a...

Get back the output of os.execute in Lua

When I do an "os.execute" in Lua, a console quickly pops up, executes the command, then closes down. But is there some way of getting back the console output only using the standard Lua libraries? ...

Is there a way to determine the signature of a Lua function?

Recently, Lee Baldwin showed how to write a generic, variable argument memoize function. I thought it would be better to return a simpler function where only one parameter is required. Here is my total bogus attempt: local function memoize(f) local cache = {} if select('#', ...) == 1 then return function (x) ...

Lua = operator as print

In Lua, using the = operator without an l-value seems to be equivalent to a print(r-value), here are a few examples run in the Lua standalone interpreter: > = a nil > a = 8 > = a 8 > = 'hello' hello > = print function: 003657C8 And so on... My question is : where can I find a detailed description of this use for the = operator? How d...

Java: Scripting language (macro) to embed into a Java desktop application

I am writing a graphics application in Java. Eventually I would like to build in a scripting language so things are programmable. Which language library do you recommend? Likely suspects are: Rhino (JavaScript) JRuby (Ruby) Jython (Python) Less likely candidates are: Whip up my own language using JavaCC LuaJava (Lua) Groovy JavaFX...

What's a good IDE to use for Lua?

I've got things minimally working in Scite... and a quick browse tells me that there is an Eclipse plugin and several other standalone editors, in addition to other general purpose editors with Lua capability. Out of that, what do people recommend? Particularly, what do people who program primarily in Lua like to use? Edit: Thanks for ...

Is _VERSION the only global variable left in Lua 5.1?

Puzzled by the Lua 5.0 documentation references to things like _LOADED, LUA_PATH, _ALERT and so on (that I could not use in Lua 5.1), I discovered all of those have been removed and the functionality put elsewhere. Am I right in thinking that the only one global variable left in Lua 5.1 is _VERSION? ...

What can I do to increase the performance of a Lua program?

I asked a question about Lua perfromance, and on of the responses asked: Have you studied general tips for keeping Lua performance high? i.e. know table creation and rather reuse a table than create a new one, use of 'local print=print' and such to avoid global accesses. This is a slightly different question from Lua Patterns,Tips ...

Are there any recent Lua to JavaScript converters or interpreters somewhere?

I need to find a good Lua to JavaScript converter; lua2js on luaforge.org is out of date (3 or so years old and looks like it doesn't work on Lua 5.1) and I haven't yet found anything on Google. Does anyone have any experience with any other converters out there? It should work on Lua 5.1 and preferably be .NET based, but .NET is not a ...

What's a good C memory allocator for embedded systems?

I have an single threaded, embedded application that allocates and deallocates lots and lots of small blocks (32-64b). The perfect scenario for a cache based allocator. And although I could TRY to write one it'll likely be a waste of time, and not as well tested and tuned as some solution that's already been on the front lines. So what ...

Creating standalone Lua executables

Is there an easy way to create standalone .exe files from Lua scripts? Basically this would involve linking the Lua interpreter and the scripts. I believe it is possible (PLT Scheme allows the creation of standalone executables in the same way), but how, exactly? ...

What is the meaning of 'attempt to index upvalue'

I am taking my first steps programming in Lua and get this error when I run my script: attempt to index upvalue 'base' (a function value) It's probably due to something very basic that I haven't grasped yet, but I can't find any good information about it when googling. Could someone explain to me what it means? ...

LuaSocket FTP always times out

I've had success with LuaSocket's TCP facility, but I'm having trouble with its FTP module. I always get a timeout when trying to retrieve a (small) file. I can download the file just fine using Firefox or ftp in passive mode (on Ubuntu Dapper Linux). I thought it might be that I need LuaSocket to use passive FTP, but then I found tha...