[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Need help indexing C userdata
- From: Sean Conner <sean@...>
- Date: Wed, 12 Feb 2020 11:30:21 -0500
It was thus said that the Great Lee Shallis once stated:
> I doubt the problem is anywhere but where I create the data so I'll add
> that below
>
> > int lua_proc_glance_grab( lua_State *L ) {
> > proc_glance_t *glance =
> > (proc_glance_t*)lua_newuserdata(L,sizeof(proc_glance_t));
> > if ( glance ) return 1;
> > luaL_setmetatable(L,PROC_GLANCE_CLASS);
> > return 1;
> > }
> >
> Any ideas based on what causes this:
>
> > local glance = class_proc_glance.new()
> > if glance then
> > local notice = glance:init("gasp")
> >
> To spit this out:
>
> > gasp/lua/cfg/proc.lua:7: attempt to index a userdata value (local 'glance')
What entries exist in the metatable PROC_GLANCE_CLASS? If you haven't
defined __index to be either a function or a table, then you'll get this
error message.
-spc