Assign a C++ function to a global lua variable
Teto <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
Hi folks,
I want to overwrite the __newindex method for a certain type of class from
the C++ side (to prevent creation of new properties without me noticing it,
it prevents me from mistyping variables).
Here is as far as I go:
bool
CLuaVM::setSpecialNewIndex(const char* class_name){
luabind::object obj = get_class_names( getVM() );
luabind::object mt = getmetatable(obj[class_name]);
mt["__newindex"] = specialNewIndex; // specialNewIndex should be the
function called when __newindex is called from lua for that class
}
It's late here so maybe that's why I miss something.
Matt
------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user