lua

how can I embed lua in java?

is LuaJava a must for this? or can I embed lua into java without it? ...

How to make a lua app for PSP?

I am trying to use Luaplayer HM v2 on my PSP, but I am unable to make a simple Helo World app. I have tried a lot of thing's but it simply doesn't work. All tutorials, app that I found are for LuaPLayer, I cannot find anything for Luaplayer HM v2. Please help me I need some tutorials or sampels for Luaplayer HM v2. Luaplayer app don't...

Lua's hybrid array and hash table; does it exist anywhere else?

Lua's implementation of tables keep its elements in two parts: an array part and a hash part. Does such a thing exist in any other languages? Take a look at section 4, Tables, in The Implementation of Lua 5.0. Lua 5.1 Source Code - table.c ...

Extracting information in a string

I would like to parse strings with an arbitrary number of parameters, such as P1+05 or P2-01 all put together like P1+05P2-02. I can get that data from strings with a rather large (too much to post around...) IF tree and a variable keeping track of the position within the string. When reaching a key letter (like P) it knows how many char...

Calling a Lua string with C

I'm trying to learn how to use Lua with C, so by now I want to try running a script without loading it from a file, since I don't want to be bothered with messing up with files. Can anybody tell me which functions do I need to call for executing a simple string or what ever? ...

Dynamically assigned table variables?

Writing a function in Lua, which creates two tables. I want the tables to be assigned to the value name with an x added, and one with a y added. For example if name was line, it would create two tables linex and liney, but I can't figure out how to do it. The following obviously doesn't work (and is just for display purposes) but how wou...

Easily porting Lua code to C#

Hello, is there any easy way to port Lua code to C#? The biggest problem would probably be to port tables neatly in some dictionaries. And to prevent any misunderstanding: no I cannot use embedded Lua in my program. ...

Problem with multiple scripts and Lua Threads

When I have two scripts with the same function names and arguments run in different threads with SUPPOSEDLY different environments, the second thread ends up overwriting the definitions of the first and the first thread's state gets garbage collected! // My thread instancing function lua_State* LuaInstance::RunInstance(const std::string...

How could I embedded socket in Lua internally, just like oslib, debuglib?

I want to implement the function like embedding the socket function in my Lua build. So I don't need to copy socket.core.dll any more (just for fun). I search the maillist, and see some guys discuss the topic, http://lua-users.org/lists/lua-l/2005-10/msg00269.html But I have question for the details steps, who could give me a detailed ...

Interprocess communication with Lua and C#

I have an application in Lua, I want to communicate between the Lua application and a C# program. I know of several ways to do this in C# (sockets, OS pipes etc) but I can't find any information about these things in Lua (which is a language I'm rather unfamiliar with unfortunately). The IPC sending and receiving must not block for lon...

Problem in luabind with default_converter and tables

===Edit=== The problem is actually much simpler than this, any wrapped function that takes a table is causing the problem. If I wrap a function that takes luabind::object, and call that function with a table argument, then the gc causes an invalid free(). I'm starting to think that this may be some kind of crazy compilation/linking pr...

How to I pass a table from lua into C++?

How would I pass a table of unknown length from lua into a bound C++ function? I want to be able to call the lua function like this: call_C_Func({1,1,2,3,5,8,13,21}) And copy the table contents into an array (preferably STL vector)? ...

Luabind conditionally calling Lua function

I have some code using Luabind, and I need to execute a function (from C++) if it's present in the _G table, but otherwise do nothing. How do I detect if a function is present in _G or not? ...

Alternatives to Love2D for a Lua 2D Graphics Lib

I'm looking for alternatives to the Love2D graphics/game library which ideally would support the following: Easy primitive rendering (e.g. points, lines, 2d polygons) Ability to load and draw images basic text rendering (though something more full-featured would be nice) Do any others exist? ...

ANTLR - Writing a tree grammar for an AST

I have an AST outputted for some Lua code by my grammar file, which currently does parsing and lexing for me. I want to add a tree grammar to this, but since i'm using C# i'm not sure how to do it. What's the basic process for generating tree grammar code when you already have a parser and lexer written? UPDATE: I have the following gra...

why doesnt my lua class implementation work?

I have implemented OOP in my lua environment but it doesnt seem to be working. I think it has something to do with how i am handling the __index and my improper use of require and module but I'm not 100% sure. Here is the code: Class = function( prototype ) local derived = {} local derivedMT = { --When indexing int...

Unusual ANTLR error when attempting to reorganize grammar into two files

I am reorganizing my grammar into two files in order to accomodate a tree grammar; Lua.g and LuaGrammar.g. Lua.g will have all of my lexer rules, and LuaGrammar.g will have all of my tree grammar and parser rules. However, when i try and compile LuaGrammar.g i get the following error: [00:28:37] error(10): internal error: C:\Users\RCIX...

Error handling in Lua using longjmp

I'm embedding a Lua interpreter in my current project (written in C) and I am looking for an example of how to handle errors. This is what I have so far... if(0 != setjmp(jmpbuffer)) /* Where does this buffer come from ? */ { printf("Aargh an error!\n"); return; } lua_getfield(L, LUA_GLOBALSINDEX, "myfunction"); lua_call(L, 0, 0);...

How to check if a table contains an element in Lua ?

Is there a method for checking if a table contains a value ? I have my own (naive) function, but I was wondering if something "official" exists for that ? Or something more efficient... function table.contains(table, element) for _, value in pairs(table) do if value == element then return true end end return false en...

Best approach to writing oo Lua interfaces in c?

Consider the following example (a simple 2d vector lib). Here there is a single constructor function which returns an object table with methods. My issue with this approach is that it is creating new tables with every constructor. Is there a way to use a single instance of the table but change only the _data field which identifies the...