[Question] private server -  register data without adding it to the global table menu

Shout-Out

User Tag List

Results 1 to 3 of 3
  1. #1
    Makkah's Avatar Active Member Authenticator enabled
    Reputation
    45
    Join Date
    Jun 2024
    Posts
    67
    Thanks G/R
    10/29
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    [Question] private server - register data without adding it to the global table

    Hello everyone,

    I'm working with the Lua C API (specifically Lua 5.1), and I had a quick question:

    Is there a way to register data from C++ — such as tables, functions, or libraries — in a way that doesn’t put them directly into the global table (_G), but still allows them to be accessed as if they were global within a script?

    Basically, I’m looking to create an isolated namespace (like a custom environment) where I can expose C++ bindings without cluttering the global scope, while keeping access in Lua code as clean as possible — e.g., being able to call MyFunction() instead of _A.MyFunction().

    Any tips, patterns, or best practices for this kind of sandboxed-but-global-style registration would be greatly appreciated!

    Thanks in advance!

    [Question] private server -  register data without adding it to the global table
  2. #2
    scizzydo's Avatar Established Member
    Reputation
    193
    Join Date
    Oct 2019
    Posts
    129
    Thanks G/R
    5/86
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Makkah View Post
    Hello everyone,

    I'm working with the Lua C API (specifically Lua 5.1), and I had a quick question:

    Is there a way to register data from C++ — such as tables, functions, or libraries — in a way that doesn’t put them directly into the global table (_G), but still allows them to be accessed as if they were global within a script?

    Basically, I’m looking to create an isolated namespace (like a custom environment) where I can expose C++ bindings without cluttering the global scope, while keeping access in Lua code as clean as possible — e.g., being able to call MyFunction() instead of _A.MyFunction().

    Any tips, patterns, or best practices for this kind of sandboxed-but-global-style registration would be greatly appreciated!

    Thanks in advance!
    setfenv can be your friend with a metatable to have __index and __newindex

  3. Thanks Makkah (1 members gave Thanks to scizzydo for this useful post)
  4. #3
    Makkah's Avatar Active Member Authenticator enabled
    Reputation
    45
    Join Date
    Jun 2024
    Posts
    67
    Thanks G/R
    10/29
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the idea about metatables, it really helped! I realized you only need to register around 10 methods across all object types. Once you hook the UnitID to GUID function, any function that uses UnitID will now work with GUID.

Similar Threads

  1. [Question] Private server 3.3.5 exploits?
    By dealerx in forum World of Warcraft General
    Replies: 0
    Last Post: 01-10-2017, 05:12 AM
  2. [Client] Been away from the private server game for a while. Looking to get back into it.
    By D40XxPhotoman in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 05-14-2014, 04:06 PM
  3. Private server guide(not sure if it has been made but i didnt see one)
    By Spiritae in forum World of Warcraft Guides
    Replies: 8
    Last Post: 12-10-2008, 09:33 PM
  4. [Question]Private Server Tutorial
    By winckler in forum WoW EMU Questions & Requests
    Replies: 1
    Last Post: 10-11-2008, 01:41 PM
  5. [Question] (Private) server side changes
    By khaosstrike in forum WoW ME Questions and Requests
    Replies: 3
    Last Post: 10-21-2007, 03:11 AM
All times are GMT -5. The time now is 07:43 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search