Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8513125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:28:09+00:00 2026-06-11T04:28:09+00:00

I’m designing a hospital integration system which consumes data from various hospitals (our customers),

  • 0

I’m designing a hospital integration system which consumes data from various hospitals (our customers), and then applies specific business rules to said data based on reading configurations from a database. If I were using Java, my first instinct would be to build a series of interfaces representing the various business rules, and then inject concrete instances (using Spring/guice) to compose a fully configured object. This would allow me to achieve a clean separation between configuration logic (what biz rules should apply to Hospital Foo?) and the actual business rules themselves.

Unfortunately, I’m not using Java, I’m using Lua. I’ve immersed myself in Lua literature over the last few days, and the closest analogue to DI appears to be the use of modules. Furthermore, it appears that the rules that govern how lua modules are resolved at run-time are based entirely on interrogating the local file system.

Is the “module pattern” the best/only way to achieve what am I after (separation of configuration logic from biz logic)? If so, how can one leverage Lua’s module loading rules to vary the actual module(s) loaded at run-time?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:28:10+00:00Added an answer on June 11, 2026 at 4:28 am

    Step 1: Stop thinking like a Java programmer.

    You’re in Lua now. There are no classes with explicit and compile-time fixed prototypes. Functions are first-class objects; they are values. So break the problem down in that way.

    You have a bunch of “rules” (ie: functions). You want to apply some of those rules to certain data. You have a configuration system that says, “When applying rules to data from location X, use this set of rules.” So… do that.

    You detect that data comes from location X. So you call your configuration logic to build a Lua table for location X that contains your rules (ie: functions) to apply to that data. The configuration logic for location X loads the rules from wherever they are stored, and returns them. If the configuration is in a database or something, then the database entry for location X would probably refer to rules by name.

    How you convert that rule name into an actual Lua function is up to you, but there are many ways. You could have a registry that preloads all of the Lua files from a directory into a table, and then pick the rule based on names in that table. Or perhaps you have a database of named Lua files/scripts, each of which is a separate rule. There are any number of ways to implement this.

    In Lua, “dependency injection” is just “deciding how to build collections of functions.” It’s not a special thing because Lua is a much more free-form language than Java. It’s just a matter of where the functions come from, how to put them together in a table, and then how to apply that table to some data. And all of those are up to you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have an autohotkey script which looks up a word in a bilingual dictionary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.