[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: I Can't Get Lua 5.1 and IUP 3.30 to Work With VSCode and GCC on Windows 10 x64
- From: nerditation <nerditation@...>
- Date: Mon, 25 Oct 2021 16:06:45 +0800
On 2021/10/25 15:28, Sean Conner wrote:
> It was thus said that the Great nerditation once stated:
>
> Starting from here:
>
>> typedef struct {
>> char const *name;
>> lua_CFunction loaderfn;
>> } Preloader;
>>
>> /* list the Lua modules you want to preload here */
>> static const Preloader preloaders[] = {
>> { "iuplua", &iuplua_open },
>> { NULL, NULL },
>> };
>
> to here, can be replaced with:
>
> static luaL_Reg const preloaders[] =
> {
> { "iuplua" , &iuplua_open },
> { NULL , NULL }
> };
>
> And from here:
>
>> Preloader const *mod = &preloaders[0];
>> while (mod->name != NULL) {
>> lua_pushcfunction(L, mod->loaderfn);
>> lua_setfield(L, -2, mod->name);
>> ++mod;
>> }
>
> to here, replace with:
>
> luaL_setfuncs(L,preloaders,0);
>
>
> Just FYI.
>
ah, thanks a lot.
that's how you know you use too much "high-level" "modern" C++ binding library that you forget the basic APIs.