lua

Linking Lua with Visual Studio 2010

We use Lua (www.lua.org) script to let users to customize our server software written in C++. At the moment we are porting the 32 bits Windows version of our project to Visual Studio 2010. Once everything works fine with VS 2008, we thought that we would have no problem on upgrade process. Unfortunately whenever we tried to link the lu...

Loading LuaInterface in .net4

I have a C# application I'm working on with which I want to use the excellent LuaInterface. However when I run the application I get this exception when I try to do something with LuaInterface: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional c...

Lua - Question on modules

Say I want to make a module for say a set of GUI controls, how would I create a module that would load all of the GUI scripts, and should I put those scripts as modules themselves? I was thinking of having a system like this: module("bgui", package.seeall) dofile("modules/bgui/control.lua") dofile("modules/bgui/container.lua") dofile("...

Lua equivalent to Python dis()?

In Python you have the ability to view the compiled bytecode of a user-defined function using dis. Is there a builtin equivalent to this for Lua? It would really useful! ...

transforming an image into an array of lines to draw

How do I generate a list of lines to draw if I have pixel data for an image, so I don't have to draw every pixel? Any language will do, although I listed what I have a working knowledge for. C is ok as well. There was a limit to how many tags I could choose. Also, you can just point me toward an algorithm. ...

Lua runs out of memory

I've written a complicated lua script which uses the lua sockets library. It reads a list of files from disk, sorts them by date and sends them to a HTTP process. The number of files on disk is around 65K.The memory usage in taskmanager doesn't exceed 200Mb. After quite a while the script returns: lua: not enough memory I print out t...

Why does Lua default to global variables?

My favourite language these days is Lua. I have only one issue with it, why on earth is its default behaviour that variables in functions are global? In the similar language Icon there is a keyword "global" that is used when one really wants to use a global instead of the natural behaviour to default to local (I was bitten by this again ...

Binding C# Functions to Lua for use inside C#

I want to be able to write a lua script in a text box on a form and then run the script while being able to list globals. I have tried LuaInterface but it does not play well with the Debugger, when i try to debug it there is no output from the lua code. Also i have tried Tao.Lua with the same result. The binding or workaround needs to wo...

What would make it easier to really work with Lua?

I love Lua, using it for more and more projects as the primary (not embedded) language. My current project is approaching 10,000 lines and will probably end at about 15,000 lines. What have you found useful when developing in Lua at that scale? What have you bumped your head against, and what solutions have you found? I'm thinking about ...

Simple interpreter to embed and extend inside an C++ Windows application

I need a simple interpreter which will do execution (evaluation) of simple expressions/statements and also call functions from main C++ applications. At the moment I do not need scripting of the application, but it may be useful later. It should also be strait-forward for other team members to pull my application from Source Repository ...

Embedding LuaInterface in C# has a poor performance?

I've embedded the LuaInterface project into an application written in C# using .NET Framework 4.0. After compiling LuaInterface and Lua 5.1 I've referenced them in my application and created a Lua VM and exposed a few .NET classes. When the Lua VM doesn't make many calls, performance is not affected at all; but when it starts to call a l...

Can 32bit Lua bytecode work on a 64bit system?

Can a compiled Lua file (32bit *.luac file) work on a 64 Bit system? ...

Lua shutdown/End of the program execution callback

I am writing a module for Lua. On closing the lua interpreter it must run clean up routines even if user forgets to call shutdown routine implicitly. The module is mostly written in C. What callback in Lua C Api should I use to detect end of program execution? The only idea I have come with is using __gc metamethod on table representi...

Embedding LuaInterface in a C# application has slow performance?

I've embedded the LuaInterface project into an application written in C# using .NET Framework 4.0. After compiling LuaInterface and Lua 5.1 I've referenced them in my application and created a Lua VM and exposed a few .NET classes. When the Lua VM doesn't make many calls, performance is not affected at all; but when it starts to call a l...

__newindex api C lua

The question is how to do the following, from the Lua C API: settings.default.color = 10 --(raise an error) persistent.channel.xxx = 15 --(call function to set) y = persistent.channel.xxx --(call function to read) ...

What does it mean, in Lua, to assign an undefined identifier to an undeclared variable?

I was perusing an Lua code file, and the very top of the file contains: 1 | TradeSkillFrameReset = TradeSkillFrame_LoadUI; 2 | 3 | TradeSkillFrame_LoadUI = function() 4 | TradeSkillFrameReset(); ... 112| TradeSkillFrame_LoadUI = TradeSkillFrameReset; ... 114| end; The very fi...

Building/Running Lua from Visual Studio

I'm a total noob when it comes to linking and building with Visual Studio. I would like to integrate Lua into my C++ console application. Can someone give a step by step on how to do this from getting the Lua dependencies from lua.org, to actually running a "Hello World from Lua" in VS, and all the steps in between. Finding something ...

C++ Lua 5.1 Issue

#include <stdio.h> #include <string.h> #include <lua.h> #include <lauxlib.h> #include <lualib.h> int main (void) { char buff[256]; int error; lua_State *L = lua_open(); /* opens Lua */ luaL_openlibs(L); while (fgets(buff, sizeof(buff), stdin) != NULL) { error = luaL_loadbuffer(L, buff, strlen...

n-digit Pattern Matching in Lua

I'm new to Lua. Say i have a string "1234567890". I want to iterate over all possible 3 digit numbers. (ie 123,234,345,456....) for m in string.gmatch("1234567890","%d%d%d") do print (m) end But this gives me the output 123,456,789. What kind of Pattern should i be using? And secondly, a related question, how do i specify ...

Build Automation & MySQL Workbench Scripting: Forward Engineer SQL CREATE SCRIPT

I'm currently looking into automating a software build process that includes a database schema defined in MySQL Workbench. Using Workbench's scripting capabilities, I'd like to open a Workbench document and export its schema as an SQL CREATE script. What I'd like to know is if there is a function that exports the entire schema in one s...