metaldc4life Posted September 9, 2014 Share Posted September 9, 2014 what does this mean?: attempt to call global 'require' (a nil value) Quote Link to comment Share on other sites More sharing options...
metaldc4life Posted September 9, 2014 Author Share Posted September 9, 2014 to go into further detail I am trying to add an animated deer so I add the script it came with and got this: attempt to call global 'require' (a nil value) on this line: require("scripts/class") Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted September 9, 2014 Share Posted September 9, 2014 require("scripts/class") This was something from Leadwerks 2 and is no longer used in Leadwerks 3 Quote Link to comment Share on other sites More sharing options...
metaldc4life Posted September 9, 2014 Author Share Posted September 9, 2014 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 Quote Link to comment Share on other sites More sharing options...
Guppy Posted September 9, 2014 Share Posted September 9, 2014 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 Quote 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 More sharing options...
AggrorJorn Posted September 9, 2014 Share Posted September 9, 2014 The scripts still works with some tweaks. As for the require keyword, this is no longer used in LE3. If you want to import another script you can use the import keyword. Quote Link to comment Share on other sites More sharing options...
Guppy Posted September 9, 2014 Share Posted September 9, 2014 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 ) Quote 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 More sharing options...
AggrorJorn Posted September 9, 2014 Share Posted September 9, 2014 Yes you are correct. I should have said: the require("scripts/class") is no longer used in LE3. Quote Link to comment Share on other sites More sharing options...
shadmar Posted September 9, 2014 Share Posted September 9, 2014 you can change it from require("scripts/class") to import "scripts/class.lua" Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Josh Posted September 9, 2014 Share Posted September 9, 2014 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. Quote 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 More sharing options...
AggrorJorn Posted September 9, 2014 Share Posted September 9, 2014 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 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.