lua-users home
lua-l archive

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


Здравствуйте, Soni.

Вы писали 30 сентября 2015 г., 22:05:37:



> On 30/09/15 03:04 PM, Sean Conner wrote:
>> It was thus said that the Great Soni L. once stated:
>>>
>>> On 30/09/15 01:34 PM, Luiz Henrique de Figueiredo wrote:
>>>>> If Lua doesn't need a registry then neither does C.
>>>> That's not true. Lua is an embedded language and C code may need to
>>>> store things in a Lua state that Lua scripts cannot have access to
>>>> because of security. Not everything that can be done to Lua in C should
>>>> be exposed to Lua scripts.
>>>>
>>> function f()
>>> local i = 3
>>> return function() print(i) end
>>> end
>>>
>>> Does another script have access to i?
>>    Only if the debug module is available.  But then again, if the debug
>> module is available, so is the registry.
>>
>>    -spc
>>
>>
> Precisely. The registry is useless.


How  you  suggest  e.g. create  new  Lua  objects  from  C. You can not use
closures   because   it   is  not  C  value  but  Lua. But you need to
find at least metatable and if you store metatable in upvalue you have
to  use  lua_call  to  call  this closure. But from where you get this
closure?

--
С уважением,
 Alexey                          mailto:alexeymelnichuck@gmail.com


---
Это сообщение проверено на вирусы антивирусом Avast.
https://www.avast.com/antivirus