Since my game, which I'd really like to be Mono-usable, does not seem to run under Linux because LuaInterface is being a jerk (see the the relevant SO thread for more on that), I've decided to do what's suggested there. I wrote my own Lua511.LuaDLL class to reflect the one used by LuaInterface, replacing every single public function with...
I'am trying to return a string from a function but it doesn't compile.
When I replace the std::string& type with int& it compiles, however I want to return additionally to the boolean a std::string how do I do this?
bool luacw_getElementContent( std::string name, std::string& content, bool fromBeginning )
{
content = "test";
retur...
I have an application that uses lua files for some of its more obscure configuration options. As such it mostly contains calls into the app to create things and alter properties; most C functions don't have a return value but some do.
I now have a need to read these same configuration files into a different application, and perform sig...
I want to create a table like
myTable = {
[0] = { ["a"] = 4, ["b"] = 2 },
[1] = { ["a"] = 13, ["b"] = 37 }
}
using the C API?
My current approach is
lua_createtable(L, 0, 2);
int c = lua_gettop(L);
lua_pushstring(L, "a");
lua_pushnumber(L, 4);
lua_settable(L, c);
lua_pushstring(L, "b");
lua_pushnumber(L, 2);
lua_settable(L, ...
I downloaded Eclipse Classic off of the Eclipse website then the Lua Eclipse IDE plugin. I followed the install instructions but Eclipse doesn't seem to recognize or be able to understand lua files. Can someone help?
...
I want to define a behavior on Javascript objects that kicks in when the referenced attribute/method doesn't exist.
In Lua you can do this with metatables and the __index & __newindex methods.
--Lua code
o = setmetatable({},{__index=function(self,key)
print("tried to undefined key",key)
return nil
end
})
So I'm wondering if there...
Not really know how to ask so bare with me please :)
#1 Lua:
local test = Test();
#2 C:
//creating "lua's test"
luaL_newmetatable(L, "someTable");
lua_userdata *userData = (lua_userdata *)lua_newuserdata(L, sizeof(lua_userdata));
luaL_getmetatable(L, "someTable");
lua_setmetatable(L, -2);
#3 Lua:
function test.newMethod()
end
...
Hello all,
I have currently run into an issue while toying with Lua and the alien module to use Win32 API and such from Lua scripts. So far I have only had a single issue with alien which is with the use of API that use certain structures such as CreateFontIndirect.
For example:
HFONT CreateFontIndirectA( const LOGFONT& lplf );
LOGF...
T = {
{Name = "Mark", HP = 54, Breed = "Ghost"},
{Name = "Stan", HP = 24, Breed = "Zombie"},
{Name = "Juli", HP = 100, Breed = "Human"}},
Questions:
How would I Print just the names?
and
How can I sort it by HP?
...
I am trying to sort but there is a nil. How can i get around this?
Code im useing: (sorting it by name and HPs. in case there is duplicate HPs)
T = { {Name = "Mark", HP = 54, Breed = "Ghost"},
{Name = "Stan", HP = 24, Breed = "Zombie"},
{Name = "Juli", HP = 100, Breed = "Human"},
{ HP = 100, Breed = "...
Want the function to sort the table by HP but if duplicate HPs then sorts by name. When i run this function it just groups the duplicate HPs together in no order by the name.
T = { {Name = "Mark", HP = 54, Breed = "Ghost"}, {Name = "Stan", HP = 24, Breed = "Zombie"}, {Name = "Juli", HP = 100, Breed = "Human"}, { HP = 100, Breed = "Human...
Lets say I am running a script and the game client waits for the script to be finished before it updates. Can Lua do somthing of a 'timeout'? Like, can i set a priority on the update so it leaves the script to do the update and then after words could it go back to where it was in the script?
...
I have a table that has multiple functions in it. I'm trying to write a single function that will go through and use all the functions by passing random information into it.
Methods = {}
insert functions into Methods Table
function Methods:Multi() if #self > 0
then .........................
I'm guessing i need a loop t...
I Have stumbled on a weird behavior in Lua unpack function
table1 = {true, nil, true, false, nil, true, nil}
table2 = {true, false, nil, false, nil, true, nil}
a1,b1,c1,d1,e1,f1,g1 = unpack( table1 )
print ("table1:",a1,b1,c1,d1,e1,f1,g1)
a2,b2,c2,d2,e2,f2,g2 = unpack( table2 )
print ("table2:",a2,b2,c2,d2,e2,f2,g2)
Output:
table1:...
Hi,
I made a class using wxwdigets
//wrapper over wxIPV4address
class IPV4addressLua : public wxIPV4address
{
public:
IPV4addressLua();
~IPV4addressLua();
bool SetService (const wxString &service);
bool SetService (unsigned short service);
unsigned short GetSer...
Is it possible to create a directory in lua ? If so, how ?
...
I need a game state object in lua(not c++ or tied to C++) to manage lights, cameras, objects, events from my C++ engine (the lua objects are seperate entities from c++, pretty much just standard lua tables). I am concerned about how the GC is going to act in removing these objects since they are going to be created and removed on the fly...
I have a Lua web app.
I would like to connect and query my MySQL database. I've googled and etc and have not found a good way to do so from Lua.
Any idea how I can connect and query my MySQL from within my Lua web app?
Thanks
...
I have several Lua scripts that run experiences and output a lot of information, in text files and in the console. I'd like to add some colors in the console output, to make it more readable.
I know that it's possible to color the output of bash scripts using the ANSI escape sequences. For example :
$ echo -e "This is red->\e[00;31mRE...
I have lua embedded in my game engine and a directory structure of lua files, and i am starting to use lots of lua scripts. I want to use "requrie" to optimize module includes, but i am unsure how to set the CPATH and PATH values because i have lua embedded. How can I set this up?
And also, since require looks for modules and not paths,...