[Ipe-discuss] "loadstring" in ipelets

Jan Hlavacek jhlavace at svsu.edu
Sat Oct 24 21:19:22 CEST 2009


Hi, 

I was wondering if somebody familiar with lua could help me with this:

I am just learning lua, and I am trying to write an ipelet in which I need to
execute a user supplied piece of lua code. I am trying to use "loadstring", but
I always get an error: 

attempt to call global 'loadstring' (a nil value)

This is the part of code that fails:

    local coordstr = "math.cos(t),math.sin(t)" --this will eventually be user supplied
    coordstr = "return function (t) local v = ipe.Vector(" .. coordstr .. "); return v end"
    local f,err = loadstring(coordstr,"parametric_plot")

-- 
Jan Hlavacek (jhlavace at svsu.edu, (989) 964-2004)
Department of Mathematical Sciences, Saginaw Valley State University
http://www.svsu.edu/~jhlavace/



More information about the Ipe-discuss mailing list