Jump to content

attempt to call global 'require' (a nil value)?????


metaldc4life
 Share

Recommended Posts

so there is no way to use it? =/

 

do you know how I can get this to work then?

 

require("scripts/class")

 

local class=CreateClass(...)

 

class.beginframe = 0

class.endframe = 301

class.animationspeed=0.35

 

function class:CreateObject(model)

local object=self.super:CreateObject(model)

model:SetRotation(Vec3(0,math.random(500)-1,0))

uninstancedframe=class.beginframe+math.random(class.endframe-class.beginframe)-1

object.frame=uninstancedframe

 

function object:Draw()

self.frame = self.frame + class.animationspeed * AppSpeed()

if self.frame>class.endframe then

self.frame=0

end

self.model:Animate(self.frame,1,0,1)

end

 

end

Link to comment
Share on other sites

While not I'm 100% certain I believe that require is used for including binary plugins and include is used to include scripts.

 

Also require is turned off in sandbox mode, not sure about include

System:

Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k

Link to comment
Share on other sites

As for the require keyword, this is no longer used in LE3.

 

That's not entirely accurate as I wrote above it's still used to load binary lua plugins ( when not in sandbox mode )

System:

Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k

Link to comment
Share on other sites

import() is a Leadwerks command and will work with all our file system features. For example, it can be used to execute scripts within a Workshop game, while keeping all files inside an encrypted zip file.

 

require is a Lua command. It should work, but might not be enabled if Lua sandboxing is turned on.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

What I meant on my first post is that the OP is using a lua script from Leadwerks 2.

 

If you are looking for a simple animation test, use this script:

 

Script.speed=1.0--float
Script.sequence=0--int

function Script:UpdateWorld
 local t = Time:GetCurrent()/100
 self.entity:SetAnimationFrame(t * self.speed, 1, self.sequence)
end

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...