lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Thank you for the timely reply, but I have another question ;) I am trying to 
create my tagmethod in C, for instance:

int setGlobalTagMethod(lua_State *state)
	string varname = lua_tostring(state, -2);
	int ref = lua_ref(state, 0);
	if(varname == "variable")
		cout << "variable is read-only, cannot write to" << endl;
		return 0;

	lua_pushstring(state, varname.c_str());
	lua_getref(state, ref);

	lua_rawset(state, -3);
	return 0;

Now I want to set that tagmethod for the tag of that cfunction, but there 
doesn't seem to be any kind of lua_gettag method (basically no equivalent to 
tag() from the base lib), and I can only lua_settag a tab or userdata. Maybe 
I am just missing something basic here ;)

Thanks guys.


> See 3.3 in for some ideas.
> --lhf