lua

Lua Library for Jabber

Does anyone know of a Jabber library for Lua? I've found the 'Lua Messaging Library' for AIM, although I can't find a download for it, it appears to be abandoned. Something like that for Lua would be helpful. Thanks RyanE ...

Does full userdata __gc metamethod need to free() it's memory?

I have a full userdata in Lua module written in C. The userdata has __gc() metamethod, which is called by garbage collector. Does lua interpreter free userdata memory after __gc() call, or do I have to free() it inside __gc()? ...

Design questions for an OOP library in Lua

I implemented a small OOP library in Lua, and two things are not quite right yet. I need your advice! How to call super()? I need to make a choice. The three arguments I need to resolve a call to super() are: The class from where the call is being made (CallerClass) The instance to be passed (self) The name of the method (method) ...

Efficient heap-manager for heavy churn, tiny allocs?

I'm looking for ideas for a heap-manager to handle a very specific situation: Lots and lots of very small allocations, ranging from 12 to 64 bytes each. Anything bigger, I will pass on to the regular heap-manager, so only tiny blocks need be catered for. Only 4-byte alignment is needed. My main concerns are Overhead. The regular libc ...

With Lua and Python embeddable, is there a place for Basic?

I started off programming in Basic on the ZX81, then BASICA, GW-BASIC, and QBasic. I moved on to C (Ah, Turbo C 3.1, I hardly knew ye...) When I got started in microcontrollers I regressed with the BASIC Stamp from Parallax. However, BASIC is/was awesome because it was so easy to understand and so hard to make a mistake. I moved on t...

What is the fastest webserver solution with the lowest memory footprint?

I need a webserver to serve up very simple POST/GET requests as JSON. I don't need MVC, Rails, Django. I need something that takes up very little memory, preferrably around 5K per reqeust. The webserver will talk to backend services like Scribe using Facebook Thrift. Each http request will also access a SQLLite database, one for each...

Lua as a general-purpose scripting language?

When I see Lua, the only thing I ever read is "great for embedding", "fast", "lightweight" and more often than anything else: "World of Warcraft" or in short "WoW". Why is it limited to embedding the whole thing into another application? Why not write general-purpose scripts like you do with Python or Perl? Lua seems to be doing great ...

Do any .NET DLLs exist that implement luac's functionality?

Does anyone know of any DLLs (preferably .net) that encapsulate the lua 5.1 compiler? I'm working on a .net project where part of it needs to compile lua scripts, and i would rather have a DLL that i could send script code to instead of sending the script to a temporary file and running luac.exe. Edit: I'd need a .NET library that impl...

Parsing Unix/iPhone/Mac OS X version of PE headers

This is a little convoluted, but lets try: I'm integrating LUA scripting into my game engine, and I've done this in the past on win32 in an elegant way. On win32 all I did was to mark all of the functions I wanted to expose to LUA as export functions. Then, to integrate them into LUA, I'd parse the PE header of the executable, unmangle ...

Has Lua a future as a general-purpose scripting language?

As already discussed in "Lua as a general-purpose scripting language?" Lua currently probably isn't the best scripting language for the desktop environment. But what do you think about the future? Will Lua get so popular that there will soon be enough libraries to be able to use it like Python, Ruby or something similar? Or will it sim...

how can I assign table names to variables?

I have a table in lua with some data. sometable = { {name = "bob", something = "foo"}, {name = "greg", something = "bar"} } I then want to loop through the table and assign a number to each name as a variable. New to lua and tried it like this. for i,t in ipairs(sometable) do t.name = i end I was then assuming print("n...

Calling Win32 functions returning strings with alien in Lua

I'm trying to use alien to call Win32 functions. I tried this code, but it crashes and I don't understand why. require( "alien" ) local f = alien.Kernel32.ExpandEnvironmentStringsA f:types( "int", "string", "pointer", "int" ) local buffer = alien.buffer( 512 ) f( "%USERPROFILE%", 0, 512 ) ...

How to pass large struct back and forth between between C++ and Lua

I am looking at embedding Lua in a C++ application I am developing. My intention is to use Lua to script what ordered operation(s) to perform for some given input, ie. receive a new work item in c++ program, pass details to Lua backend, Lua calls back into c++ to carry out necessary work, returns finished results. The primary data stru...

What is the standard (or best supported) big number (arbitrary precision) library for Lua?

I'm working with large numbers that I can't have rounded off. Using Lua's standard math library, there seem to be no convenient way to preserve precision past some internal limit. I also see there are several libraries that can be loaded to work with big numbers: http://oss.digirati.com.br/luabignum/ http://www.tc.umn.edu/~ringx004/m...

How can I determine the OS of the system from within a Lua script?

Ok I need to determine the system's OS from a Lua script, but Lua as such has no API for this, so I use os.getenv() and query enviromental variables. On Windows checking the enviromental variable "OS" gives me the name of the system's OS, but is there some variable that exists on both Windows and most flavors of Unix that can be checked?...

Is Lua, Perl, Python, or Ruby better suited for Unix system automation?

I am starting a new project to provide monitoring and control services for a number of unix (Linux and FreeBSD) servers (think munin, monit, mrtg, etc). The reason I'm not considering using an already existing monitoring solution is that I need to do checks for custom APIs (like post a specific HTTP request and parse the answer body for ...

What can Lisp do that Lua can't?

Lua's most direct competitor in the scripting arena is Python. So it commonly gets compared with Python, however I've heard many times that Lua is very much like Lisp(Scheme) in terms of expressive power and flexibility. Now I'm a Lua power-user, and know its intricacies in and out, but I've only tried Lisp once or twice, so obviously ...

Is there anyway to avoid this security issue in Lua?

I was just working on a localizable Lua string solution, when I came up with this hack, problem is I don't know how to avoid getting hacked by it :) So I was wondering if anyone, has done something similar and or knows how to protect from this kind of attack. (in user code) Since we can do this: =("foo"):upper() -->output: FOO It can...

Is MEF Microsoft's version of Lua?

I see parallels between MEF and Lua. Both allow you to register methods and deploy as you need. Are both MEF and Lua forms of IoC / Dependency Injection? ...

How does Linq work (behind the scenes)?

I was thinking about making something like Linq for Lua, and I have a general idea how Linq works, but was wondering if there was a good article or if someone could explain how C# makes Linq possible Note: I mean behind the scenes, like how it generates code bindings and all that, not end user syntax. ...