[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: can't find
- From: Benjamin von Ardenne <benjamin.von.ardenne@...>
- Date: Sun, 12 Feb 2012 12:17:18 +0100
>From http://www.lua.org/pil/8.html :
The loadstring function is similar to loadfile, except that it reads
its chunk from a string, not from a file. For instance, after the code
f = loadstring("i = i + 1")
f will be a function that, when invoked, executes i = i + 1:
i = 0
f(); print(i) --> 1
f(); print(i) --> 2
The loadstring function is powerful; it must be used with care. It is
also an expensive function (when compared to its alternatives) and may
result in incomprehensible code. Before you use it, make sure that
there is no simpler way to solve the problem at hand.
Please read the manual carefully!
On Sun, Feb 12, 2012 at 12:11 PM, Роман Рубан <email@example.com> wrote:
> studing lua and it's raisen a question. i've got a lua string with some code. how can i execute it from lua without writing to file and calling dofile? is there any resources?