Despite searching hard, i couldn't find a valid Lua C API example for calling a Lua function returning a table. I'm new to Lua and the Lua C API, so don't assume too much. However i can read and have understood the principle of loading a Lua module from C and passing values via the stack and calling Lua code from C. However i did not find any example of how to handle a table return value.
What i want to do is call a Lua function that sets some values in a table (strings, ints, ) and i want to get these values back in the C code that called the function.
So the Lua function would be something like:
function f()
t = {}
t["foo"] = "hello"
t["bar"] = 123
return t
end
(I hope this is valid Lua code)
Could you please provide example C code of how to call this and retrieve the table contents in C.