Can someone explain this to me? I have figured it out through this tutorial that this is known as a table. Coming from a C/C++ background, can someone explain how this works (I am trying to understand some existing Lua code)?
config = {
devices = {
C56 = "/dev/ttyS2",
ELTRA = "/dev/ttyS3",
-- MICORE = "/dev/ttyS4",
H...
Hi,
i am trying to integrate a scripting mechanism to my existing project.However i could not understand how to pass objects to lua with luabind.
For example i have an entity class and i want to update them in lua files.
#include <stdio.h>
#include <ctime>
#include <iostream>
#include <string>
#include <list>
using namespace std;
ex...
Lua functions can return multiple results :
a, b, c = unpack({'one', 'two', 'three'})
If I'm not interested in the third return value, I can choose to ignore it when calling the function :
a, b = unpack({'one', 'two', 'three'})
Is there a similar way to ignore the X first elements when calling the function ?
I could write this cod...
I have a very simple little piece of Lua code, which I wrote while teaching myself how coroutines work.
I was fine until I got to coroutine.wrap, the spec states:
coroutine.wrap (f)
Creates a new coroutine, with body f.
f must be a Lua function. Returns a
function that resumes the coroutine
each time it is called. Any arg...
Hi all, just a quick check...
local var1, var2;
Is var2 a local variable here? Or is only var1 a local?
Thanks.
...
I have found myself having to turn a chunk of Lua code into a string so it can be run as a proper Lua chunk.
Writing code like that is not too difficult, but it's time consuming and prone to minor errors that result in lost development time and patience.
Is there any tool/filter capable of taking a piece of runnable code and turning it ...
I have the ability to read the memory with Lua, but I've run into a problem.
I want to read a float value.
I have, what I presume to be a float, in the memory which looks like this.
Byte Array 65 B6 40 43 EC 35 87 41 51 04 9E 3F
Float Value 192.712478637695
I know the float value because I'm using a memory editor.
In Lua I have a fun...
Ruby has this very interesting functionality in which when you create a class with 'Class.new' and assign it to a constant (uppercase), the language "magically" sets up the name of the class so it matches the constant.
# This is ruby code
MyRubyClass = Class.new(SuperClass)
puts MyRubyClass.name # "MyRubyClass"
It seems ruby "captures...
Does anyone know if LuaJava works out of the box with the latest LuaBinaries or just the 5.1.1 binaries? Thanks.
http://www.keplerproject.org/luajava/index.html
...
I am looking for a good scripting language to link to my program.
I am looking for 2 important attributes:
Scripting language should be hard linked into the executable (not requiring 3rd party
installations). This is important to me to simplify distribution.
Scripting should allow some run-time debugging option (When running a script ...
Hello,
I need to translate this piece of code from Perl to Lua
open(FILE, '/proc/meminfo');
while(<FILE>)
{
if (m/MemTotal/)
{
$mem = $_;
$mem =~ s/.*:(.*)/$1/;
}
elseif (m/MemFree/)
{
$memfree = $_;
$memfree =~ s/.*:(.*)/$1/;
}
}
close(FILE);
So far I've written ...
Here is the thing. I am trying to convert a string in lowercase in Lua, but it's not working. I have done this
String = String:lower()
but it doesn't like it. I am sure that is the way to do it, I've seen it done before. A few sites suggest it might be a problem caused by a wrong version of the interpreter.
Any ideas?
...
Hello,
i have an array which might contain duplicate objects.
I wonder if it's possible to find and remove the duplicates in the array:
- without sorting (strict requirement)
- without using a temporary secondary array
- possibily in O(N), with N the nb of the elements in the array
In my case the array is a Lua array, which contains ta...
Hi.
We're working on multiple computers, executing a program coded in c/c++ and using lua api, and each one of them get crashed with different errors. It's usually either a segmentation fault, whose backtrace leads us to a call made bu liblua, or one that is usually given when trying to call a nil value as if it was a function.
The wei...
Does anybody here have a experience with Common Lisp as a embedded language (using ECL)? If so, how good is ECL compared to Lua?
...
This works...
if ( tileType == "water" or
( otherObj and otherObj:GetType() == "IceBlock" )) then
self:SetNoClip( true )
else
self:SetNoClip( false )
end
-
These don't...
self:SetNoClip( tileType == "water" or
( otherObj and otherObj:GetType() == "IceBlock" ))
//----------------------------------------------------------
l...
I'm just starting C++ development using Qt. However, I'm also interested in using Lua to script my app, given various articles stating its development speed (ease) for writing the workflow/ui/glue of an application. However, out of the box Qt doesn't support it, instead it includes QtScript.
My question is basically should I attempt to ...
In a C app when I call a Lua script, do the variables in the code stay with the same value when I call the script again later?
...
I know that I can concatenate strings in Lua like so
String = String .. 'more'
But what if I want to add HTML and want to keep (obviously) the way it looks?
For example, how do I overcome the
luac: Perl to Lua:226: unfinished string near '''
error I get when I do this
Html_string = Html_string .. "
<tr> ...
I am trying to understand what the difference is between string.find and string.match in Lua. To me it seems that both find a pattern in a string. But what is the difference? And how do I use each? Say, if I had the string "Disk Space: 3000 kB" and I wanted to extract the '3000' out of it.
EDIT: Ok, I think I overcomplicated things and ...