lua-users home
lua-l archive

Re[2]: Privacy

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


Hello Edwin,
EEM> Mayber you can check out Programming in Lua
EEM> and read the part on object orientation:
EEM> http://www.lua.org/pil/16.html
It's a case if class privacy.
I need 'interface' privacy.
Example:
somecode.c ----------
 lua_State* L;
 
 static const luaL_reg banklib[] = {
 {"CurrenAccount", curAcc},
 {"CurrentPassword", curPwd},
 {"GetAdminPassword", adminPwd},
 {NULL, NULL}
 };
 luaL_openlib(L, "bank", banklib, 0);
 
----------------
script.lua ------------
 for line in pairs(bank) do
 print(line)
 end
 
------------
output:
 CurrenAccount
 CurrentPassword
 GetAdminPassword
But I want to hide 'GetAdminPassword' from ENUMERATING.
Of course, if user knows that 'bank' table has method 'GetAdminPassword', he
can call it.
-- 
Best regards,
Stukov
mailto:Stukov@gala.net

AltStyle によって変換されたページ (->オリジナル) /