lua

Lua - How to use functions from another script

I'm wondering how to use functions from another script in Lua. For example, say GameObjectUtilities holds functions that many GameObject scripts will use. The Slime (a GameObject) script wants to use a function in GameObjectUtilities. I'm having trouble getting this to work. I've looked here, but I still don't really fully understand. D...

Differing paths for lua script and app

My problem is that I'm having trouble specifying paths for Lua to look in. For example, in my script I have a require("someScript") line that works perfectly (it is able to use functions from someScript when the script is run standalone. However, when I run my app, the script fails. I believe this is because Lua is looking in a locati...

Clone a lua state

Recently, I have encountered many difficulties when I was developing using C++ and Lua. My situation is: for some reason, there can be thousands of Lua-states in my C++ program. But these states should be same just after initialization. Of course, I can do luaL_loadlibs() and lua_loadfile() for each state, but that is pretty heavy(in fac...

Does Lua support Unicode?

Based on the link below, I'm confused as to whether the Lua programming language supports Unicode. http://lua-users.org/wiki/LuaUnicode It appears it does but has limitations. I simply don't understand, are the limitation anything big/key or not a big deal? ...

Lua .NET How to use the standard and third party libraries

I am using Lua inside C# WinForms application for GUI automation testing. I want to use the logging library http://www.keplerproject.org/lualogging/ But I don't know where to copy those logging library files and other standard lua files so that I can use the standard lua logging within the lua scripts. I see something like LUA_PATH bu...

Has anyone used Lua for web development?

Has anyone used Lua for web development? If so, what was your experience of Lua vs using Perl/Ruby/Python/PHP/etc ...

How to get name of the argument in lua?

I have lua function which accept the arguments. I want to get the name of the argument so that I can log the argument along with error. Any idea how to get argument name in lua? ...

Scite Lua - escaping right bracket in regex?

Hi all, Bumped into a somewhat weird problem... I want to turn the string: a\left(b_{d}\right) into a \left( b_{d} \right) in Scite using a Lua script. So, I made the following Lua script for Scite: function SpaceTexEquations() editor:BeginUndoAction() local sel = editor:GetSelText() local cln3 = string.gsub(sel, ...

D callbacks in C functions

I am writing D2 bindings for Lua. This is in one of the Lua header files. typedef int (*lua_CFunction) (lua_State *L); I assume the equivalent D2 statement would be: extern(C) alias int function( lua_State* L ) lua_CFunction; Lua also provides an api function: void lua_pushcfunction( lua_State* L, string name, lua_CFunction func ...

How to wrap a C function whose parameters are pointer to structs, so that it can be called from Lua?

I have the follwing C function. How should I wrap it so it can be called from a Lua script? typedef struct tagT{ int a ; int b ; } type_t; int lib_a_f_4(type_t *t) { return t->a * t->b ; } I know how to wrapr it if the function parameter type were int or char *. Should I use table type for a C structure? EDIT: I am usi...

List of Lua derived VMs and Languages

Is there a compendium of virtual machines and languages derived or inspired by Lua? By derived, I mean usage beyond embedding and extending with modules. I'm wanting to research the Lua technology tree, and am looking for our combined knowledge of what already exists. Current List: Bright - A C-like Lua Derivative http://bluedino.ne...

Long IF tree with strings

I have a C program which uses Lua for scripting. In order to keep readability and avoid importing several constants within the individual Lua states, I condense a large amount of functions within a simple call (such as "ObjectSet(id, "ANGLE", 45)"), by using an "action" string. To do this I have a large if tree comparing the action stri...

How to call Lua functions from .NET

I use the LuaInterface library to run the lua in .net and it works fine. I could access the CLR via lua. But how to call Lua function from C#? ...

Read nested Lua table who key is a System.Double

Using C# and LuaInterface, I am trying to read a nested table, but am getting a null LuaTable when I try to open the key containing the table. The .lua file: DB = { ["inventory"] = { [10001] = { ["row"] = 140, ["count"] = 20, }, [10021] = { ["row"] = 83, ["coun...

Lua on Android: Comment character

I have a tiny Lua script which is supposed to disable call forwarding: require 'android' android.dialNumber('*21#') The problem is that the script only dials '*21' and omits the '#' character. Playing around It looks to me like the # character is treated as comment character as everything after it is ignored. I've tried singel and do...

current line number in Lua

Does Lua support something like C's __LINE__ macro, which returns the number of the current code line? I know Lua has a special built-in variable called _G, but I don't see line number in there... ...

Converting Luabind to C#?

Has anybody tried converting Luabind to C#? Is such a thing even possible? I've got an application that I want to convert so that it can run in a completely managed environment, but most of the game logic relies upon Lua scripts, and the application uses Luabind to manage the back-and-forth. I'm not familiar enough with Lua or Luabind...

Lua API for TokyoTyrant

Hi SO folks, I didn't managed to find an Lua client/api for TokyoTyrant. Such Api exists for TokyoCabinet, but not for TT. And Perl and Ruby API exists for TT. TT provides a native binary protocol, a memcached-compatible protocol, and an HTTP-oriented protocol. So my questions are : 1/ Do you think using the memcached (using luamemca...

2d trajectory planning of a spaceship with physics.

I'm implementing a 2D game with ships in space. In order to do it, I'm using LÖVE, which wraps Box2D with Lua. But I believe that my question can be answered by anyone with a greater understanding of physics than myself - so pseudo code is accepted as a response. My problem is that I don't know how to move my spaceships properly on a 2...

wrapp a function whose parameters are out type pointer to structure using swig

I have following function : typedef struct tagT{ int a ; int b ; }Point; int lib_a_f_5(Point *out_t) { out_t->a = 20; out_t->b = 30; return 0; } How should I direct the SWIG to generate the correct code for ruby (or lua)? When putting following statement to the interface file : %apply SWIGTYPE Point* {Point *out_t}; I got a warn...