lua

I want to read the source code of a real compiler. Suggestions on which & how? Any experiences to share?

In order to continue my dive into reading real code, I'd like to read and understand the source code of an actual in-use compiler. Is there one that you think is particularly well-written, elegant, and perhaps, still relatively small? Any suggestions? Any experiences? Resolution: I've decided to read the Lua source code. I've been bookm...

Which game scripting language is better to use: Lua or Python?

Hi, I have to program a game engine starting very soon for a 3rd year Games technology project. As a part of our project we have to integrate a scripting language for scripting our NPCs and other elements of the game. I know that Lua has been very popular in recent years and Python has horrible white space issues, however it is making a...

Prototype based object orientation. The good, the bad and the ugly?

Hello, I come from classes object orientation languages and recently I have been learning those fancy dynamic languages (JavaScript, Python and Lua) and I want some tips about how to use OO in those languages. It would be useful to know the pitfalls and the shortcomings of such approach and the advantages compared to traditional OO. The...

wxLua: upload files with wxFtp

I'm trying to use wxFTP on wxLua to upload several files. It works with the 1st file, but I do not understand why I cannot send a 2nd file. Here is a sample that fails : local ftp = wx.wxFTP() local ftpAddress = wx.wxIPV4address() ftpAddress:Service( "ftp" ) ftpAddress:Hostname( "ftp.example.com" ) ftp:Connect( ftpAddress ) local out1 =...

Scientific libraries for Lua?

Are there any scientific packages for Lua comparable to Scipy? Thanks for your time and help :) ...

What are the most effective ways to use Lua with C#?

From my understanding, Lua is an embeddable scripting language that can execute methods on objects. What are the pitfalls to avoid? Is is it feasible to use Lua as an interpreter and execute methods in an web environment or as a rule engine? ...

What are the strengths of Lua over CSharpCodeProvider in C# for dynamic code execution?

In my scenario I want to interpret a script file and execute methods from assemblies. What advantages would Lua offer me? If you have used both Lua and the CSharpCodeProvider please contrast your experience with both. ...

Embedding Lua in Objective Caml (OCaml)

Could you, please, give a code snippet showing how to use Lua embedded in OCaml? A simple example could be a "Hello, World" variant. Have OCaml prompt the user for a name. Then pass that name to a Lua function. Have Lua print a greeting and return the length of the name. Then have OCaml print a message about the length of the name. ...

Are scripts "open source" by definition?

The other day, I tweaked a script for a friend's World of Warcraft addon. He was surprised that you could edit the addons—that they were "open source." (Word of Warcraft addons are written in the Lua scripting language) I found myself wanting to say "Sure you can—all scripts are 'open source'." Is that true? Sure, some scripts can be co...

How do I create a Lua Table in C++, and pass it to a Lua function?

Hi, In C++, I have a map<string, string>, containing an unknown number of entries. How can I pass this to a Lua function, so that the Lua function can use the data as a table? Hugo ...

Why is the first random number always the same on some platforms in lua ?

Consider the following lua code snippet : local time = os.time() for _= 1, 10 do time = time + 1 print('Seeding with ' .. time) math.randomseed(time) for i = 1, 5 do print('\t' .. math.random(100)) end end On a Linux machine, the result is, as expected, random numbers. But it seems that at least on Mac OS X, t...

Lua - Syntax error in if-statement

Hi! Just tried to execute a small Lua script, but unfortunately I'm doing something wrong. I've no more ideas what the fault might be. function checkPrime( n ) for i = 2, n-1, 1 do if n % i == 0 then return false end end return true end The interpreter says: lua: /home/sebastian/luatest/test.l...

Lua - Current time in milliseconds

Hi, another Lua question: Is there a common way to get the current time in or with milliseconds? There is os.time(), but it only provides full seconds. ...

Lua syntax highlighting in KDevelop

Does anyone know how to fix the Lua syntax highlighting in Kdevelop. The # symbol used to get the length of a table causes the remainder of the line to appear as if it is commented out. t[#t+1] = "foo" ...

How to Read only the last line of a text file in Lua?

I have a program that generates text fiels that can be up to 20 mets in size. Sometimes I only care about the last line in the file, is there a way to read just that line with out wasting memory reading the rest of the file? ...

Lua on Rails?

Is there a library like Rails for Lua? ...

How do I design the structure a CAD package ?

Hi all, I am developing, in C++, a Computer Aided Design package for Printed Circuit Boards and Schematics (aka EDA CAD). It uses Lua for some specific things, but I would like to expand the role of Lua so that it implements much of the user interface logic. I would like to re-build the internals in a way which lets people change the ...

Accessing the Body of a Function with Lua

I'm going back to the basics here but in Lua, you can define a table like so: myTable = {} myTable [1] = 12 Printing the table reference itself brings back a pointer to it. To access its elements you need to specify an index (i.e. exactly like you would an array) print(myTable ) --prints pointer print(myTable[1]) --prints 12 N...

The compilation process

Can anyone explain how compilation works? I can't seem to figure out how compilation works.. To be more specific, here's an example.. I'm trying to write some code in MSVC++ 6 to load a Lua state.. I've already: set the additional directories for the library and include files to the right directories used extern "C" (because Lua i...

Lua COM Programming

Anyone know of any examples that shows COM programming via Lua? Could require a library. I need to write some external scripts for Photoshop, so wondering if it's possible with Lua. ...