|
Hi,
In C++, I have a map<string, string> , containing an unknown number of entries. How can I pass this to a Lua function, so that the Lua function can use the data as a table?
Hugo
Started by Rocketmagnet on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Generalized pairs is expected....
Create a proxy table table
A discussion of fixes to Lua for generalized pairs is in the wiki and this mailing list thread .
Copy the map into a new Lua table, and pass the Lua table.
A couple options...
|
|
Currently I'm building my own script VM manager class in C++, I have no problems with any of the lua & lua C or C++ stuff, but the one section that confuses me is: when to use lua_pop and when to use lua_remove .
From what I understand, lua_pop is to ...
Started by Necrolis on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
lua_getfield(L, LUA_GLOBALSINDEX, "t"); /* table to be indexed */ lua_getfield(L, -1, "x"); /* push result of t.x (2nd arg) */....
Snippets from Lua reference manual .
A typical example of lua_remove is accessing tables.
|
|
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?
Started by RCIX on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
But at least....
When I opened the file another error when it is wrong) .
Add more information
Which installation guide did you follow? ( Lua Eclipse Installation ?) Which a generic project, added a generic file linked to an existing Lua file.
|
Ask your Facebook Friends
|
Hi all?
I read something about Lua this day, and I was wondering what it was. I did a Google and Wikipedia (I understanded it until they begun talking about a C API) search bit I still don't understand it. Can someone explain me what Lua is and maybe ...
Started by Koning Baard XIV on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
It allows to use the simpler syntax of....
Lua is a lightweight interpreted programming language developed in Brazil with a focus on embedding:
print("Hello World!")
Wikipedia Summary
Official Site
Lua is a scripting language for C and C++.
|
|
I am using the lua C-API to read in configuration data that is stored in a lua file.
I've got a nice little table in the file and I've written a query C-function that parses out a specific field in the table. (yay it works!)
It works by calling a few ...
Started by Oren on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
If your C function is called by another C function that uses the Lua stack, then those values will....
If your C function is called from Lua, the values you leave behind will be the values that your C function returns to Lua.
It depends.
|
|
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...
Started by Etan on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
#include <stdio.h> #include "lua.h" #include "lauxlib.h" #include "lualib.h" int main() { int res; lua_State *L = lua_open(); luaL_openlibs(L); lua_newtable(L); /* bottom table */ lua....
Is the lua_setfield function.
|
|
I'm trying to load tables from Lua to C++ but I'm having trouble getting it right. I'm getting through the first iteration just fine but then at the second call to lua_next it crashes. Any ideas?
Lua file:
level = { 1, 2, 3, }
C++ file - First I did this...
Started by Jonas on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
When you call lua the stack with
lua_getglobal(L, ....
Why are you doing the extra lua_pop(L, 1) at the end of the version from the reference manual? I can see how that could be a problem, since you're popping beyond the stack depth.
|
|
It looks like BREW 4.0 will have Lua included. But is it possible to use Lua on older BREW 3.0 (or even BREW 2.0)?
Started by Maxim on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Check out LuaBREW project as an example of approach I briefly explained... .
It is possible, but you will have to link lua interpreter source code to your application source code and wrap BREW API functions in order to use them from lua scripts.
|
|
I was wondering, what can i use to program in Lua on the Mac? I'm looking for something that i can use to compile/interpret lua script on the mac.
Started by RCIX on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
It will build lua (the interpreter which (from the shell):
sudo port install lua
I LOVE macports!
Here is my terminal session from compiling and installing Lua from....
The Lua source easily compiles with no changes on the mac.
|
|
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!\...
Started by Adam Pierce on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
I think....
Here 's a cross-referenced Doxygen of the same.
This is defined in the Lua core header lstate.h .
The jump buffer chain is part of the struct lua_longjmp pointed to by errorJmp field in the per-thread state struct lua_State .
|