• Couldn't include file 'includes\modules\xxx.lua' (File not found)
    4 replies, posted
So basically i have a script. Now i want that another script uses a function from the first script. I tried the following: [CODE]require("cl_special_frame") specialmenu()[/CODE] And after a while i tried to optimise it: [CODE]spcop = require("cl_special_frame") spcop.specialmenu()[/CODE] The Problem however lies in a whole different category (as i think) Thats the error: [CODE]Couldn't include file 'includes\modules\cl_special_frame.lua' (File not found) [/CODE] Why does it think it is a module? The wiki clearly states, that if it Fails to load a binary module it will search for lua files with the given Name (which i guess it doesn't) By the way, cl_special_frame.lua is inside lua/special/cl_special_frame.lua just to make it clear that its just a lua script. I mean i really could just copy paste the code i use in script one... But i want to make it recursive... Any help is appreciated! [B]If possible do not give the solution right away but just give me something to think about it ;)[/B] Things i additionally tried: require("../../special/cl_special_frame") > To get out of the module Folder. Problem 1 for some reason it uses Windows \ and not Linux /... Don't know if it has something to do with Gmod itslef (rollingeyes) Problem 2 > Same Problem as the try below that one here. require("special/cl_special_frame") > Thing is that it searches for lua scripts with the same Name so thats just dumb. Still tried though xD I mean i could put cl_special_frame into includes/modules/. by just making a symbolic link... But seriously thats not how i should do it :/
You need to use include.
[QUOTE=txike;51816442]You need to use include.[/QUOTE] But include will run the script. I dont want that :/
[QUOTE=Zmeja;51816445]But include will run the script. I dont want that :/[/QUOTE] require runs the script too. require is not intended in gmod for what you are trying to do. It isn't even capable of returning anything in gmod. include is capable of returning. The answer is to use include. You're trying some gimmicky shit with require. Whatever you're trying to do, figure it out with include, cause require is not the answer.
[QUOTE=sannys;51816461]require runs the script too. require is not intended in gmod for what you are trying to do. It isn't even capable of returning anything in gmod. include is capable of returning. The answer is to use include. You're trying some gimmicky shit with require. Whatever you're trying to do, figure it out with include, cause require is not the answer.[/QUOTE] Okay thanks :) EDIT: Works now :)
Sorry, you need to Log In to post a reply to this thread.