[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How to load lua extensions using C API?
- From: Kevin Martin <kev82@...>
- Date: Thu, 8 Aug 2013 10:13:20 +0100
I just set package.preload.packagename to the loader function of the extension. Obviously you have to do this after loading the package library. Also this won't set globals, the scripts will still need to require your extension.
I'm pretty much against setting globals, but if you really want to, you can write a c function that basically executes "%s = require(\"%s\")" for a given argument and then lua_call it after you've put the loader in package.preload.
Thanks,
Kev