lua-users home
lua-l archive

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

Title: Implementing read only tables using C API

Hi there,

First of all I apologies if this has been covered (if it has feel free to point me in the right direction).

I would like to create a table within my app that is accessable to Lua scripts that just defines some values that can't be changed.  I have PiL 2nd edition and in that it describes how to do it implement this from within a lua script itself and I have tried to implement this using the C API, but my understanding must be somewhat lacking as I can't quite get it to work.  (Either that, or the example isn't quite what I had in mind).  I can get an error on __newindex, but I don't know how to stop assignments to existing entries.

Any help on this matter would be greatly appreciated.