lua

why do i get "attempt to call global 'require' (a nil value)"??

I have 3 lua files, Init.lua, FreeCamera.lua and Camera.lua , init.lua calls require "Core.Camera.FreeCamera" Free Camera: module(...) require "Core.Camera.Camera" local M = {} FreeCamera = M M = Class( Camera ) function M:__constructor(x,y,z) self.Active = false self.x = x self.y = y self.z = z end and module(...) lo...

Finding the spin of a sphere given X, Y, and Z vectors relative to sphere

I'm using Electro in Lua for some 3D simulations, and I'm running in to something of a mathematical/algorithmic/physics snag. I'm trying to figure out how I would find the "spin" of a sphere of a sphere that is spinning on some axis. By "spin" I mean a vector along the axis that the sphere is spinning on with a magnitude relative to the...

LUA 'plain' string.gsub

Hi, I've hit s small block with string parsing. I have a string like: footage/down/temp/cars_[100]upper/cars[100]_upper.exr and I'm having difficulty using gsub to delete a portion of the string. Normally I would do this lineA = footage/down/temp/cars_[100]_upper/cars_[100]_upper.exr lineB = footage/down/temp/cars_[100]_upper/ ne...

How to remove a lua table entry by its key ?

I have a lua table that I use as a hashmap, ie with string keys : local map = { foo = 1, bar = 2 } I would like to "pop" an element of this table identified by its key. There is a table.remove() method, but it only takes the index of the element to remove (ie a number) and not a generic key. I would like to be able to do table.remove(...

Embedded wxLua not displaying most controls (but still does layout correctly)

I am having trouble getting embedded wxLua to work with my application -- it works fine when I use the wxLua DLLs, but I'm trying to use the static libraries so I can distribute a single, standalone executable with no external dependencies. First, the symptoms: Most controls (such as wxButtons, wxGauges, wxTextCtrls) do not display; at ...

Swig and Lua: how to map Lua file to FILE*

I have a C function that takes FILE* as an argument and I'd like to use this function in Lua, passing Lua file. I guess I need a %typemap for this. How to write it? (I just started learning Lua). ...

Find X/Y/Z rotation angles from one position to another

I am using a 3D engine called Electro which is programmed using Lua. It's not a very good 3D engine, but I don't have any choice in the matter. Anyway, I'm trying to take a flat quadrilateral and transform it to be in a specific location and orientation. I know exactly where it is supposed to go (i.e. I know the exact vertices where the...

C++ Preprocessor metaprogramming: obtaining an unique value?

Hi, I'm exploiting the behavior of the constructors of C++ global variables to run code at startup in a simple manner. It's a very easy concept but a little difficult to explain so let me just paste the code: struct _LuaVariableRegistration { template<class T> _LuaVariableRegistration(const char* lua_name, const T& c_name) { ...

Can't lua_resume after async_wait ?

Hi, I have some lua script that have some long running task like getting a web page so I make it yield then the C code handle get page job async, so the thread free to do other job and after a specify time it check back to see is the get page job finished , if so then resume the script. the problem is the thread can't resume the job afte...

Implementing and inheriting from C++ classes in Lua using SWIG

Would it be possible using Lua and SWIG and say an IInterface class, to implement that interface and instantiate it all within Lua? If so how would it be done? ...

Manipulating Email on IMAP server with imapFilter

I am writing a Lua script that works with IMAPfilter (http://imapfilter.hellug.gr/), that is able to change the names of MIME attachments for example: Content-Type: application/pdf; name="Final Fäntäsy.pdf" is converted to Content-Type: application/pdf; name="FinalFantasy.pdf" Currently, this is done via exporting the mail to the...

Can doubles be used to represent a 64 bit number without loss of precision

I want to use lua (that internally uses only doubles) to represent a integer that can't have rounding errors between 0 and 2^64-1 or terrible things will happen. Is it possible to do so? ...

lua call function from a string with function name

Is it possible in lua to execute a function from a string representing its name? i.e: I have the string x = "foo", is it possible to do x() ? If yes what is the syntax ? ...

Wrapping a Lua object for use in C++ with SWIG

Currently I know how to have C++ objects instantiated and passed around in Lua using SWIG bindings, what I need is the reverse. I am using Lua & C++ & SWIG. I have interfaces in C++ and objects in lua, that implement methods which do the same job and have the same structure. I would like to be able to instantiate these objects in lua y...

Lua string.format options

This may seem like a stupid question, but what are the symbols used for string replacement in string.format? can someone point me to a simple example of how to use it? ...

Lua - get command line input from user?

In my lua program, i want to stop and ask user for confirmation before proceeding with an operation. I'm not sure how to stop and wait for user input, how can it be done? ...

Getting a Process to terminate

I have a process object setup like the following: Process p = new Process(); p.StartInfo.FileName = command; p.StartInfo.UseShellExecute = true; p.StartInfo.Arguments = String.Format( commandArguments, destinationLocation, sourceLocation, sourceDirName, (string.IsNullOrEmpty(revisionNotes.Text)) ? "" : revisionNotes....

expect replacement

I want to work with a modem interfaced on a serial port on an embedded platform. Here are some solutions I have rejected so far : Expect plus a terminal program : My (cross)build system does not have any package rules for expect, and according to the installation instructions from the expect sources, the configure script needs to be i...

In Lua, how do I remove a table within a table?

For example: items = { [753] = { }, [192] = { }, [789] = { }, [791] = { }, [790] = { }, [776] = { }, } I would like to remove 789 and all data inside of it. I tried both: table.remove( items, 2 ); and table.remove( items, 789 ); ( I wasn't sure how the indexing worked ) with no luck. T...

Lua certified for use on an airframe or road vehicle?

Does anyone know if Lua has been certified to run on an airframe or road vehicle? Certification processes such as DO178B (RTCA) or standardization such as ISO 26262 (Road vehicles). Certification is like case law and I would feel more confident evaluating the language knowing that another company has successfully made it through a proce...