Team Spartan Cookies & Milk Forums
  • Issue Tracker
  • Donations
  • Search
  • Member List
  • Help

Register

Team Spartan Cookies & Milk Forums Feedback Suggestions and improvements v
« Previous 1 … 15 16 17 18 19 … 36 Next »
Starfall Libraries
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linear Mode
Starfall Libraries
17-01-2019, 10:56 PM,
#8
exoRift Offline
TSCM Member
***
Posts: 16
Threads: 10
Joined: Nov 2018
RE: Starfall Libraries
(17-01-2019, 05:44 PM)Person8880 Wrote: Globals are one way to pass around values, but you can also return values from files and they'll be returned by require(). For example:

mymodule/index.txt:
--@name Module Example

local Module = {}

function Module.Hello()
print( "Hello World!" )
end

return Module

In another file:
--@name Include The Module
--@dependency mymodule/index.txt

local Module = require( "mymodule/index" )
Module.Hello()

Includes are recursively resolved in dependencies too, so you can build multi-file libraries in this way.

I see. Thank you, Person.
Find
Reply
« Next Oldest | Next Newest »


Messages In This Thread
Starfall Libraries - by exoRift - 15-01-2019, 09:12 PM
RE: Starfall Libraries - by TheOneAndOnlyTee - 15-01-2019, 11:23 PM
RE: Starfall Libraries - by exoRift - 15-01-2019, 11:37 PM
RE: Starfall Libraries - by TheOneAndOnlyTee - 16-01-2019, 06:15 AM
RE: Starfall Libraries - by exoRift - 17-01-2019, 01:06 AM
RE: Starfall Libraries - by TheOneAndOnlyTee - 17-01-2019, 03:38 AM
RE: Starfall Libraries - by Person8880 - 17-01-2019, 05:44 PM
RE: Starfall Libraries - by exoRift - 17-01-2019, 10:56 PM

  • View a Printable Version
Forum Jump:


Users browsing this thread: 1 Guest(s)
Contact UsTeam Spartan Cookies & MilkReturn to TopLite (Archive) ModeMark all forums readRSS Syndication

Powered By MyBB, © 2002-2026 MyBB Group.