lua

How to iterate over a boost::fusion sequence?

I'm trying to initialise a list of args to use with fusion::invoke. The args are all of the form: template <typename Type> struct ArgWrapper { inline ArgWrapper(){} inline void Setup(lua_State*L,int idx) { //setup this value from the lua state... //in reality this class is specialised for different lua types ...

Pattern Matching with Lua's string module

I'm trying to use string.find in Lua to parse the contents of a user-entered string. There are up to three different parameters I am trying to find (if the user enters them), but sometimes only one. The input string in its longer form looks like: local userInput = "x|y|z" where x, y, and z can be any character or nothing (empty str...

Lua - Sorting a table alphabetically

I have a table that is filled with random content that a user enters. I want my users to be able to rapidly search through this table, and one way of facilitating their search is by sorting the table alphabetically. Originally, the table looked something like this: myTable = { Zebra = "black and white", Apple = "I love them!", Coin =...

Evaluating Mathematical Expressions using Lua

In my previous question I was looking for a way of evaulating complex mathematical expressions in C, most of the suggestions required implementing some type of parser. However one answer, suggested using Lua for evaluating the expression. I am interested in this approach but I don't know anything about Lua. Can some one with experienc...

How to implement a scripting language into a C application?

I have a C application and I want to include a Scripting Language to put certain functionality into scripts. I just have no experience with that and don't know exactly where to start (Still learning C and trying to understand the application). How does embedding and communication between my app and the scripts actually work? I think I n...

Using Lua for web development?

What issues or gotchas will I run into if I develop web applications in Lua; is there anything I should be aware of before starting? Any experience with developing Lua web applications? ...

Lua table lookup

I know this seems like a dumb question but how do i search a lua table for a given item? let's say i have a table like this: local table = { itemA = 0.8, itemB = 1.2, itemC = 1 } is there, say, a function named table.find or something? It's also late here so I'm not thinking too clearly at the moment... ...

What web server to use for Lua web development

What web server (and why) should I use for Lua web development? ...

Is there a way to determine parameter values passed to a Lua function from within a call to the debug hook handling the 'call' event?

I have written a Lua script that uses the debug API (debug.sethook) to hook calls and returns. I use it to print out a nicely formatted call tree - which is very useful for debugging. In the hook handler function I increment or decrement a global indentLevel variable based on whether the event is 'call' or 'return' (or 'tail return'). ...

VB6 - LUA Integration

I'm wondering if anyone has any tips for integrating LUA and VB6. I am running a small Online RPG that would be awesome to add some scripting to. ...

How do I call C++ functions from a Lua script?

I'm using Visual Studio 2005. ------------------------[ luapassing.cpp ]-------------------- #include "lua.h" static int myCfunc (Lua_State *L){ double trouble = lua_tonumber(L,1); lua_pushnumber(L,16.0 -trouble); return 1; } int luaopen_luapassing (Lua_State *L){ static const lua_reg Map [] = {{"dothis",myCfunc},{NULL,NULL...

2D Lua Games on iPhone

Are there are libraries / frameworks that facilitate 2D game programming in Lua on the iPhone? It looks like http://anscamobile.com/ and http://sio2interactive.com/GAMES.html are the only reasonable options at this point. Someone should create a simple Lua binding for OpenGL, AL and iPhone Events for the iPhone! ...

Problems with multiline EditBox widget in World of Warcraft AddOn

When I try to set the width of a multiline EditBox widget, it flickers for a moment, then gets set. Is there a way to get rid of the flickering? Or, alternatively, is there a workaround? ...

How to use lua_pop() function correctly ?

Hi! Can anyone pls tell me that how to use lua_pop() function correctly in C++. Should I call it when I use a lua_get*() function ? like. lua_getglobal(L, "something"); lua_pop(L, 1); or how to use it ? Will the garbage collector clear those stuff after the threshold ? Thanks. ...

How can I create a secure Lua sandbox?

So Lua seems ideal for implementing secure "user scripts" inside my application. However, most examples of embedding lua seem to include loading all the standard libraries, including "io" and "package". So I can exclude those libs from my interpreter, but even the base library includes the functions "dofile" and "loadfile" which access...

How to quote values for LuaSQL?

LuaSQL, which seems to be the canonical library for most SQL database systems in Lua, doesn't seem to have any facilities for quoting/escaping values in queries. I'm writing an application that uses SQLite as a backend, and I'd love to use an interface like the one specified by Python's DB-API: c.execute('select * from stocks where symb...

Lua and C-struct

how can I use c-struct in lua? ...

Programming in Lua for the Mac?

I was wondering, what can i use to program in Lua on the Mac? I'm looking for something that i can use to compile/interpret lua script on the mac. ...

lua memory managment

How can I free the lua stack? ...

How do you construct a read-write pipe with lua?

I'd like to do the equivalent of: foo=$(echo "$foo"|someprogram) within lua -- ie, I've got a variable containing a bunch of text, and I'd like to run it through a filter (implemented in python as it happens). Any hints? Added: would really like to do this without using a temporary file ...