lua-api Questions

2

Solved

There are heaps of examples of how to clone a Lua table in Lua, however I wasn't able to find any example of how to do it with the native Lua C API. I tried to do it by hand twice, but ended up wit...
Nessus asked 26/12, 2010 at 19:40

2

My C program probably has a silly bug. There is a certain point where the Lua stack doesn't contain the values that I think it should. In order to debug it, I want to print the contents of the Lu...
Homeless asked 28/11, 2019 at 14:51

5

Solved

I've been looking for first-hand information on the World of Warcraft addon API. There are a couple wikis that are pretty good, but their reference links only point internally. Surely there is some...
Revengeful asked 31/8, 2012 at 16:27

3

Solved

I'm currently learning how to use the Lua C API and while I've had success binding functions between C/C++ and Lua, I have a few questions: Is it a good idea to load multiple scripts into a singl...
Conjunctiva asked 1/4, 2016 at 12:34

4

Solved

If I understand this correctly, Lua by default will call the debug library "debug.traceback" when an error occurs. However, when embedding Lua into C code like done in the example here: Simple Lua...
Anderton asked 4/9, 2012 at 3:33

1

Solved

I'm trying to iterate over a table of tables in Lua and output: The key of each table. The key / value pair of each entry in each table. Here is the code: void print_table(lua_State *L) { lua...
Xanthous asked 26/3, 2015 at 20:16

3

Solved

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_get...
Adenoidal asked 27/10, 2009 at 11:24

1

Solved

In Lua 5.3 table related functions in the C API receive and return lua_Integer. void lua_rawgeti (lua_State *L, int idx, lua_Integer n); void lua_rawseti (lua_State *L, int idx, lua_Integer n); lu...
Zinkenite asked 11/1, 2015 at 3:48

2

Solved

test.exe call addTest.lua and set the lua_testobj to the table, and addTest.lua call testobj.dll, but testobj.dll can not get the "lua_testobj" error msg is addTest.lua:9 attempt to index loca...
Automat asked 17/12, 2014 at 2:38

1

Solved

below is the lua table i need to read from C: listen = { { port = 1234, address = "192.168.1.1", userdata = "liunx" }, { port = 1235, address = "192.168.1.2", userdata = "liunx1" }, { port = 12...
Bobbette asked 20/11, 2014 at 10:56

1

Solved

I am writing in C a userdata type for use in Lua. It has some array-type properties and various methods aswell. Right now if u is of this type, I use u:set(k,v) resp. u:get(k) to access data and e....
Brassy asked 17/11, 2014 at 10:15

2

Solved

How can I get a size of a Lua table in C? static int lstage_build_polling_table (lua_State * L) { lua_settop(L, 1); luaL_checktype(L, 1, LUA_TTABLE); lua_objlen(L,1); int len = lua_tointeger(L...
Dunaway asked 30/10, 2014 at 0:57

1

Solved

I'm trying to pass a Lua table to my C program but I don´t know how to do it. My Lua code: local stages = {} stages[1] = stage1 stages[2] = stage2 stages[3] = stage3 lstage.buildpollingtable(sta...
Jillayne asked 29/10, 2014 at 1:19

2

Solved

Is it possible to get all the errors in the lua stack from C/C++? here is what I've tried c++ int main() { lua_State* L = luaL_newstate(); luaL_openlibs(L); if (luaL_loadfile(L, "LuaBridgeScr...
Caloyer asked 13/8, 2014 at 10:0

1

Solved

I am attempting to create a GC finalizer for a function value by storing it in a weak table using the C API. I started off by writing a prototype in pure Lua 5.2: local function myfinalizer() p...
Cryptogenic asked 6/6, 2014 at 17:51

1

Solved

Using the recent luaJIT lua_open returns null. This does not happen with the regular lua library. lua_State *L = lua_open(); std::cout << L << std::endl; Output: 0x0 How can I get l...
Renfroe asked 31/12, 2013 at 14:42

3

Solved

I want to execute an untrusted .lua file in its own environment by calling lua_setfenv() so that it cannot affect any of my code. The documentation for that function though only explains how to ca...
Yonah asked 9/8, 2010 at 21:20

3

Solved

I'm working on a small project trying to integrate lua with c++. My problem however is as follows: I have multiple lua scripts, lets call them s1.lua s2.lua and s3.lua. Each of these has the follo...
Espinosa asked 7/8, 2010 at 22:8

1

Solved

luaL_loadfile(mState, path.c_str()); lua_pcall(mState, 0, 0, 0); Is there a way to put an execution time limit (say 10-20 seconds) for those two C++ statements, that load and then execute a lua f...
Roster asked 3/8, 2010 at 21:24
1

© 2022 - 2024 — McMap. All rights reserved.