Difference between revisions of "Loadstring"

From OpenEUO
Jump to: navigation, search
(Created page with " loadstring (string [, chunkname]) Similar to loadfile, but gets the chunk from the given string. To load and run a given string, use the idiom assert(loadstring(s))() W...")
 
 
Line 1: Line 1:
  loadstring (string [, chunkname])
+
  local f , err = loadstring (string [, chunkname])
  
 
Similar to loadfile, but gets the chunk from the given string.
 
Similar to loadfile, but gets the chunk from the given string.
Line 6: Line 6:
  
 
     assert(loadstring(s))()
 
     assert(loadstring(s))()
 +
 +
or
 +
 +
    dostring(s)
  
 
When absent, chunkname defaults to the given string.
 
When absent, chunkname defaults to the given string.
 +
 +
[[Dofile]]
 +
 +
[[Dostring]]
 +
 +
[[Loadfile]]

Latest revision as of 19:51, 7 October 2010

local f , err = loadstring (string [, chunkname])

Similar to loadfile, but gets the chunk from the given string.

To load and run a given string, use the idiom

    assert(loadstring(s))()

or

   dostring(s)

When absent, chunkname defaults to the given string.

Dofile

Dostring

Loadfile