What not so?

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
maxic
Posts: 64
Joined: Wed Sep 22, 2004 8:24 am
Location: Moscow, Russian Federation
Contact:

What not so?

Post by maxic »

Code: Select all

local layer = moho:CreateNewLayer(MOHO.LT_IMAGE)
layer:SetName("Test"..lay)
layer:SetSourceImage(path)
It does not work :-(

In source code *.moho file:

Code: Select all

image ""
:-(
User avatar
Lost Marble
Site Admin
Posts: 2347
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Post by Lost Marble »

Try this instead:

local layer = moho:LayerAsImage(moho:CreateNewLayer(MOHO.LT_IMAGE))
layer:SetSourceImage(path)

In C terminology, you need to "cast" the layer to an ImageLayer type.
User avatar
maxic
Posts: 64
Joined: Wed Sep 22, 2004 8:24 am
Location: Moscow, Russian Federation
Contact:

Post by maxic »

:D :D :D
Many thanks!!! The script good!
Post Reply