Jump to content

Welcome to Gaming On Steroids Forums
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account
Photo

Notes on Lua "Require" and Read/Write Files


  • Please log in to reply
1 reply to this topic

#1
c0mrade

c0mrade

    Coder

  • Members
  • 26 posts
  • LocationUK

Seen a few people and had a few questions about the requires etc... No do not put them inside lua in the riot folder...

 

Example:  this is one of my scripts, uses 2 lua files and a dll.
 

require "lfs"
require "DevCore"
require "Utils"

Above these 3 lines I can tell Lua where these files are:

package.path = package.path .. ';C:/DevCore/?.lua'
package.path = package.path .. ';C:/DevCore/?.dll'

I use C:/DevCore for ease of use.

So how can this help developers?

What you can do is call functions from other scripts or if your modifying your script but your getting annoyed with having to Alt+F4..,

You can put the function code you are trying to modify and place that into a seperate lua file, then changes will be updated in game.

You can force a refresh of a required lua or stop it, not sure if it works 100% all of the time:

 

if ReloadPressed then
        reloading=1
    else
        if (reloading==1) then
            package.loaded[ 'DevLoad' ] = nil
		require('DevLoad')
    		reloading=0
        end
    end

Stopping you simple do not call the require again.

Just a few simple points for now, I've successfully managed to include lua 5.1 compatible dll's including Lua File System and other lua features.

Final notes...

Try not to get too distracted, I ended up replacing Minion Graphics with Poro ones... Amusing but lost a fair amount of time


  • 2

#2
ilovesona

ilovesona

    Sona's wife

  • Contributor
  • 1,096 posts

Can you show some sample code about file system?


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users