lua

Does Lua support Decorators?

I come from a Python background and really like the power of Python Decorators. Does Lua support Decorators? I've read the following link but it's unclear to me: http://lua-users.org/wiki/DecoratorsAndDocstrings UPDATE Would you also mind given an example how how to implement it in Lua if it's possible. ...

How to display a progress Bar using Lua and IUP

I have built a long running script to which I have added a progress bar with the following code: function StartProgressBar() gaugeProgress = iup.gaugeProgress{} gaugeProgress.show_text = "YES" gaugeProgress.expand = "HORIZONTAL" dlgProgress = iup.dialog{gaugeProgress; title = "Note Replacement in Progress"} dlgProgress.si...

Abandoning coroutines

How bad is it in Lua 5.1 to never let a coroutine properly end? In other words, if a coroutine yields but I never resume it, does it leave a lot of state lying around until program completion? cor=coroutine.wrap(somefunc) while true do done=cor() if done then -- coroutine exited with "return true" break else -- corouti...

How do I display "image X of Y" in a Lightroom web engine Lua template?

I'm creating a new "web engine" (i.e. gallery format) for Lightroom, which uses Lua templates to generate HTML for the gallery pages. I've got both the SDK and Programmers Guide from here: http://www.adobe.com/devnet/photoshoplightroom/ But none of the SDK docs, examples, nor the Programmers Guide give me any hint of what variables I n...

Language/GUI library to make map editor

I'm designing a cross-platform map editor for an application I've developed, and I'm unsure what approach to take regarding language/gui library choice. Just for some basic info, the editor needs to parse and output xml files. I'm most comfortable with C++, Lua, and Perl, but I'd also be willing to use Python (could use the practice). I...

Getting OS version

Is there any function to get the OS type and version? ...

Lua - Cocoa - String Concat - Simple Table to NSArray

Hi all, Mac OS X 10.5 compatibility, Lua 5.0 compatibility required (hence cannot use current batch of LuaObjc bridges.) My lua script produces an indexed table containing tens of thousands of strings. Basic problem: how to concat those strings with a newline separator, to one string, quickly? Fly in ointment: even using garbage-coll...

Get Lua state from inside Lua so it can be passed back to C.

I am able to load a DLL created from C source from within Lua. So what I want to be able to do is pass the current Lua state FROM Lua to the loaded DLL. Basically I'm using a game engine that uses Lua. The scene editor of said game engine creates the Lua state and calls Lua scripts and I know for a fact that it uses 1 lua state for all...

Lua long strings not displaying correctly using geshi syntax highlighting.

I am storing my new Lua code in to a Dokuwiki system which uses the geshi highlighter (written in php). How ever I am having a problem with long string definitions in lua for example strLong = [[If this is a long string then I don't want it highlighted as code else it looks very silly]] It is possible to correct this using the gesh...

Is it possible to change strings (content and size) in Lua bytecode so that it will still be correct?

Is it possible to change strings (content and size) in Lua bytecode so that it will still be correct? It's about translating strings in Lua bytecode. Of course, not every language has the same size for each word... ...

C & Lua: luaL_dostring return value

Hey, in my C file I call luaL_dostring like this: luaL_dostring(L, "return 'somestring'"); How do I read this return value in C after this line? Thanks. Edit: Thanks for the help. I'd like to add that to remove the element after retrieving it, you use: lua_pop(L, 1); ...

lual_newstate outside of main function

I'm embedding Lua in a C++ application using Lua5.1 and I'm having an odd issue with luaL_newstate(). This works: lua_State *L = NULL; int main() { L = luaL_newstate(); return 0; } I recently restructured my code and chose to create an init function like this: lua_State *L = NULL; void init_lua(lua_State *L) { L = luaL_news...

Using LuaDoc with extensions other than .lua

I am currently developing lua scripts for a new application which requires the extension to be xx_lua. I have luadoc working fine for .lua extensions and I know I could simply rename the files to the lua extension create the documents and rename them back, but personally I would prefer a more elegant solution. Is is possible to get lu...

How to detect where strings begin in Lua Bytecode? (using C#)

How to detect where strings begin in Lua Bytecode using C#? I would like to list all the strings in a Lua Bytecode file. ...

Lua Syntax Highlighting in Java

Hi, I'm using Java Swing to develop an application and I want to use Lua as an embedded scripting language. For that I need to create a text component that would provide syntax highlighting and automatically organize the code by adding tabs and so on. Is there a library or resource that I could use in order to achieve this? Here is an ...

Reading and writing C struct from embedded lua

I'd like to embed lua to allow scripting in my C++ application. In particular, I have two structs which I'd like to pass as arguments to a given lua function. One will be read-only, the other will be read/write. Highly simplified examples of these structs follow: struct inData { int x; int y; //many other fields follow }; s...

Test that a table exists in Luasqlite

I'm using Luasqlite. If I wanted to write a test to verify that a table exists, that returns boolean, how would I go about doing it? It seems if I try selecting something from a table that doesn't exist, as my test, then the application errors out altogether. Thank you! ...

Simplest lua function that returns a vector of strings

Hi guys, I need a very simple c++ function that calls a lua function that returns an array of strings, and stores them as a c++ vector. The function can look something like this: std::vector<string> call_lua_func(string lua_source_code); (where lua source code contains a lua function that returns an array of strings). Any ideas? Th...

Documentation about lmd5, lua module.

So, where do I find any documentation to use lmd5? Thanks. ...

Passing a C# byte array to LuaInterface

I have a byte array in my C# code that I need to pass into a LuaInterface instance. I can use pack() in Lua, pass the resulting string to C# and convert it with System.Text.Encoding.UTF8.GetBytes(), but going the other way doesn't seem to work. Is there a simple solution? I'm hoping I can avoid assigning the byte array to a global valu...