Register package?
Do you have any plans to do so?
Hi @twadleigh, thanks for checking out LuaCall. :slightly_smiling_face:
I figured I would indeed register it once I've implemented more functionality. While the basics are in place, it does not currently handle tables, Lua's one composite data structure. I'd like to at least have that in before registering. I have a local branch where I've started on it, but I haven't had much time for this package lately, since I just made it for fun rather than with a specific use case in mind.
Are you finding that this package would be useful for you? If so, can I ask what your use case is? I'm curious to see the ways in which this package will be useful to folks.
I just came across it via google yesterday and saw that pkg> add LuaCall failed. My first order of business today is to see if I can get it to parse/evaluate config files that we write in Lua. The resulting value should be a table, so from what you say it sounds like there might need to be some patching to be done to get it to work. If you think it might be a useful starting point, would you consider pushing that local branch? I might spend some time this weekend to try to get it to work.
I've thinking of spending some time on this package this soon, hopefully over the next few days. I'll try to get some table functionality at least minimally working and I'll let you know how that goes.
Welp, now I remember why I hadn't gotten very far with table support before: the C API for working with tables is just nuts. It will take significant effort just to determine how to expose tables to the user in a non-painful way...
Well, I'll just scratch my immediate itch via lupa+PyCall, but I'm also reading the C API section in Programming in Lua to get up to speed on what would be involved.
The annoyance with Lua's C API is that everything is referenced by index in Lua's stack, but the index can change by pushing to and popping from the stack. For example, to accomplish Lua's equivalent of t[k] = v, for t a table, via the C API requires passing a stack index for t, a string for k (but tables needn't be string indexed, so ???), and whatever is at the top of the stack is used as v. Keeping track of all of that on the Julia side is a bit of a nightmare. I'm trying to think of a way to make it user-friendly without effectively reimplementing Lua's frontend in Julia.
For a very dirty hack using LuaCall as-is, you should be able to use the lua" string macro to evaluate arbitrary Lua code, then inspect whatever that put onto the stack using LuaCall internal functions. As long as it isn't a table.
I also have a usecase now, I want to use it to access lua api of Minetest which is a open source version(in a way) of minecraft. would be great to see some progress, I need to get familiar with lua then figure out how to use this package and what I need to write on my own :)